Skip to content

codeliner/php-ddd-cargo-sample

Repository files navigation

PHP DDD Cargo Sample

PHP 7 port of the cargo sample used in Eric Evans Domain-Driven Design book

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.

tl;dr

Click here 😄

What Is New?

  • PHP 7 with strict scalar type hints
  • PSR-7 & PSR-15 middleware layer using zend-expressive
  • Doctrine ORM ^2.5 Embeddables
  • PHPUnit ^5.0
  • Behat ^3.0
  • Single Page UI using riot.js

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.

Installation

Structure

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

PHP 5.6 compatible Version

Looking for a PHP 5.6 compatible version of the cargo sample? @josecelano has downgraded his fork. You can find it here.

Support

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

Contributing

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.

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 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. Got to the directory and simply run phpunit.

Sponsoring

prooph software

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

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.