An open API service indexing awesome lists of open source software.

https://github.com/yceruto/php-ddd-demo

Dependency-free demo project
https://github.com/yceruto/php-ddd-demo

cqs ddd hexagonal-architecture php

Last synced: 3 months ago
JSON representation

Dependency-free demo project

Awesome Lists containing this project

README

        

# PHP DDD Demo

This project is a simple, framework-free introduction to Domain-Driven Design (DDD) and use cases. It's perfect
for anyone looking to dive into the core concepts of DDD in PHP.

The demo is based on a simple task management system, where you can create tasks and log time spent on them.

![task-time-log](task-time-log.png)

tags: `domain-driven-design` `domain-event` `hexagonal-archetecture` `screaming-architecture` `clean-architecture`
`command-query-separation`

## Features

- **Entities**: Task, TimeLog
- **Value Objects**: Uuid, Duration, NonEmptyString, etc.
- **Repositories**: TaskRepository, TimeLogRepository
- **Use Cases**: CreateTask, FindTask, AddTimeLog, etc.
- **Services**: TaskCreator, TaskFinder, TimeLogCreator, etc.
- **Domain Errors**: TaskNotFound, InvalidTaskStatus, DomainError, etc.
- **Domain Events**: TaskCreated, TaskTimeLogAdded, etc.

## Setup

To run this project, you need to have PHP 8.3 or higher installed on your machine.

```bash
git clone [email protected]:yceruto/php-ddd-demo.git
cd php-ddd-demo
composer install
```

## Testing

Unit tests are implemented using PHPUnit. To run the tests, execute the following command:

```bash
vendor/bin/phpunit
```

## License

This software is published under the [MIT License](LICENSE)