DDD PHP
DDD in PHP is a simple project (a folder structure) for your project build with Domain Driven Design., (*1)
, (*2)
Installation
The recomanded way to install DDD in PHP is through Composer:, (*3)
{
"require": {
"black/ddd-php": "@stable"
}
}
Protip: You should browse the black/ddd-php
page to choose a stable version to use, avoid the @stable
meta
constraint., (*4)
Why?
First, I want to create a folder structure for my continuous project based on semantic. This small library is a good
start for my project and, even if some parts of this integration versus DDD rules are questionable, this library will
work for a lot of projects., (*5)
Usage
This project is a simple folder structure with interfaces (with simple contracts). Follow this structure and your project
will follow DDD (not exactly true but your design will be fine)., (*6)
Why you should not use this library in your project?
For a lot of good reasons like :, (*7)
-
Repository interface is in Domain\Model with 4 basics functions. If you want to add CQRS pattern over this interface, you
will need a Read and a Write side so you can't scale with this interface., (*8)
-
Repository::find() need a ValueObject. Create a concrete ValueObject implementing ValueObjectInterface and job is done... Or not
You can't accept all ValueObject for find so you will write a condition for testing the $id and use or throw an InvalidArgumentException., (*9)
So my advice (after 17 months) is: Do you want to create a DDD project? If yes, follow the rules of this package and you will create a DDD
project but you should not implement this in your project., (*10)
Contributing
This project is a work in progress so don't hesitate to see CONTRIBUTING file and submit your PR., (*11)
Credits
This README is heavily inspired by Hateoas library by the great @willdurand.
This guy needs your PR for the sake of the REST in PHP., (*12)
Alexandre "pocky" Balmes alexandre@lablackroom.com.
Send me Flattrs if you love my work, buy me gift or hire me!, (*13)
License
DDD in PHP
is released under the MIT License. See the bundled LICENSE file for details., (*14)