PHP 7 DDD Cargo Sample

PHP 7 Version of the cargo sample used in Eric Evans DDD book

Project maintained by codeliner Hosted on GitHub Pages — Theme by mattgraham

Scrutinizer Quality Score Build Status

Cargo Sample Reloaded

After two years of inactivity a new version of the PHP DDD Cargo Sample is available [2015/12/07]. The new version is a complete rewrite of the cargo sample using cutting edge technology.


This brand new cargo sample version is sponsored by prooph software GmbH. You can follow us on twitter


Click here :smile:

What Is New?

Goal of the Project

We want to show the PHP 7 way of implementing Domain-Driven Design with the help of the original Cargo sample used in Eric Evans book Domain-Driven Design: Tackling Complexity in the Heart of Software. This has also been done using Java, C#, Ruby and other programming languages.

It is not the one way to apply DDD and only covers the tactical part of DDD. However, the cargo sample should help you understand the theory and gives you a starting point. Also see the Caveats of the java implementation. The same applies for our version.


See the Installation file.


The annotated project overview gives you an idea of the system structure.


If you have any problems with the application please open a GitHub issue. Same applies if you have a question or a feature wish.


Contributions of any kind are welcome. The PHP 7 DDD cargo sample aims to help people understand the tactical design part of DDD. So we'd be very happy if you tell your friends about it, link it in discussions and mention it on twitter. If you've found a bug or have an idea for an improvement, just submit a PR like usual.

Become A Member

If you want to share your experience with other DDD enthusiasts or want to ask a question about DDD then the DDDinPHP google group is good place to do so.

You can find more DDD stuff like interesting articles and related libraries on the PhpFriendsOfDdd/state-of-the-union project.

Behavior Driven Design

All features of the application are described in feature files. You can find them in the features folder of the project. We make use of Behat and Mink to test our business expectations.

You can run the feature tests by navigating to the project root and start the selenium server shipped with the sample app: java -jar bin/selenium-server-standalone-2.46.0.jar After the server started successfully open another console, navigate to project root again and run Behat with the command php bin/behat.

*Note: If it does not work, check that the behat file is executable.

Unit Tests

Unit Tests are of course also available. You can find them in CargoBackend/tests. Navigate to the directory and simply run phpunit.