This package is abandoned and no longer maintained. No replacement package was suggested.

Implements DDD in PHP

v2.0.0 2015-01-28 15:20 UTC

This package is not auto-updated.

Last update: 2020-05-08 14:08:58 UTC


DDD in PHP is a simple project (a folder structure) for your project build with Domain Driven Design.

Latest Stable Version Total Downloads


The recomanded way to install DDD in PHP is through Composer:

    "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.


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.


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).

Why you should not use this library in your project?

For a lot of good reasons like :

  • 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.

  • 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.

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.


This project is a work in progress so don't hesitate to see CONTRIBUTING file and submit your PR.


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.

Alexandre "pocky" Balmes Send me Flattrs if you love my work, buy me gift or hire me!


DDD in PHP is released under the MIT License. See the bundled LICENSE file for details.