A default structure for CQRS oriented project and Symfony.
TODO
- PHP >= 5.3.3
Composer installation instructions
$ php composer.phar create-project -s dev tbbc/symfony-cqrs-edition path/to/install dev-master
Composer will install the project and all its dependencies under the path/to/install
directory.
Note 1: Because it is not stable yet, you have to explicity set the dev-master
version.
After composer installation is complete, visit the url to the project in your brower for further instructions!
DDD (Domain Driven Development) and CQRS (Command/Query Responsability Segregation) aims to focus on the domain (ie: your business).
This project structure tries to properly separate the technical aspects and the actual business logic.
Based on previous experiments, POO paradigms, DDD best practices, we have defined three main "layers" for an application.
It gathers the actual business logic, business rules, free of any framework implementations
This layers is splitted in two parts, as defined by the CQRS abbreviation.
The Command layer is somewhat the write layer, in charge of updating the state of your domain, while the Query is in charge of Reporting.
Infrastructure relates to any components that are not part of your domain and which interchangeables. This can be a Doctrine/DBAL repository, a Mailer service, or any third parties adapter. This is also here that we do the glue between the domain and any MVC framework.
CQRS/DDD mainly focus on a "Task Based UI", this means tasks are often mapped to actual command of your domain. UI, User Interface, is usually a website with HTML views, but it is also any CLI commands or even a REST API.
src
└── Acme
└── Task
├── Command
├── Domain
│ ├── Event
│ ├── Handler
│ ├── Model
│ └── Repository
├── Infrastructure
│ ├── InfrastructureBundle
│ └── Persistence
├── Query
│ ├── EventHandler
│ ├── Repository
│ └── ViewModel
└── Ui
├── CliBundle
├── SharedBundle
└── WebBundle
In the Symfony CQRS Edition, the InfrastructureBundle is the heart of the application. It is the glue between your domain and the actual Symfony framework.
The UI layer contains all the Controllers, as well as views, themes, or any configuration which will be passed through container parameters to your Domain.
Note: the term Command may apply to both CLI Command and Command in CQRS, it should not be confused as it refers to two different concepts
TODO
- Take a look at the list of issues.
- Fork
- Write a test (for either new feature or bug)
- Make a PR
- Boris Guéry - [email protected] - @borisguery - http://borisguery.com
- Benjamin Dulau - [email protected] - @delendial - http://benjamindulau.com
The Big Brains Company - Symfony CQRS Edition
is licensed under the MIT License - see the LICENSE file for details