Skip to content

Commit 25c04e5

Browse files
author
Codeliner
committed
Update README
1 parent 4731a94 commit 25c04e5

File tree

1 file changed

+94
-5
lines changed

1 file changed

+94
-5
lines changed

README.md

Lines changed: 94 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,100 @@
11
php-ddd-cargo-sample
22
====================
33

4-
PHP Version of the cargo sample used in Eric Evans DDD book
4+
PHP version of the cargo sample used in Eric Evans DDD book
5+
6+
Introduction
7+
------------
8+
This project is work in progress. Your welcome to fork the repo and help finishing the cargo sample application for php.
9+
The application layer is based on ZF2 and we use Doctrine2 to persist our aggregates.
10+
This would be a common combination in a large PHP project but both frameworks are not required. They just make our life easier
11+
and let us focus on the Domain Driven Design implementation. Both can be replaced with any other PHP based components.
512

613
The original cargo sample written in java can be found [here](http://dddsample.sourceforge.net/).
714

8-
This project is in a work in progress state. Your welcome to fork the repo and help to finish the cargo sample app for php.
9-
The system is based on ZF2 to get a powerful application layer out of the box and uses Doctrine2 to persist it's aggregates.
10-
This would be a common combination in a large PHP project but it is not required. We want to focus on the implementation
11-
of the domain model. The infrastructure and application layer can be replaced with any other PHP based components.
15+
Installation
16+
------------
17+
18+
Using Git and Composer (recommended)
19+
-----------------------------------
20+
Clone the repository and manually invoke `composer` using the shipped
21+
`composer.phar`:
22+
23+
cd my/www/dir
24+
git clone https://github.com/codeliner/php-ddd-cargo-sample.git
25+
cd php-ddd-cargo-sample
26+
php composer.phar self-update
27+
php composer.phar install
28+
29+
(The `self-update` directive is to ensure you have an up-to-date `composer.phar`
30+
available.)
31+
32+
Setup a Database
33+
----------------
34+
Our sample works with a MySql database so you need a running MySql Server and an
35+
empty test db called `cargo_sample`. Then you can use the [cargo_sample.sql](https://github.com/codeliner/php-ddd-cargo-sample/blob/master/scripts/cargo_sample.sql) to create all
36+
required tables, but beware that each release chips with it's own `cargo_sample.sql`.
37+
When you switch from one chapter to another you have to recreate the database schema.
38+
Finally copy and rename the [local.php.dist](https://github.com/codeliner/php-ddd-cargo-sample/blob/master/config/autoload/local.php.dist) to `local.php`
39+
and fill in your database credentials.
40+
41+
Web Server Setup
42+
----------------
43+
44+
### Apache Setup
45+
46+
To setup apache, setup a virtual host to point to the public/ directory of the
47+
project and you should be ready to go! It should look something like below:
48+
49+
<VirtualHost *:80>
50+
ServerName cargo-sample.localhost
51+
DocumentRoot /path/to/php-ddd-cargo-sample/public
52+
SetEnv APPLICATION_ENV "development"
53+
<Directory /path/to/php-ddd-cargo-sample/public>
54+
DirectoryIndex index.php
55+
AllowOverride All
56+
Order allow,deny
57+
Allow from all
58+
</Directory>
59+
</VirtualHost>
60+
61+
Goal of the Project
62+
-------------------
63+
We want to show the PHP way of implementing Domain Driven Design with the help of
64+
the originial Cargo sample used in Eric Eveans book
65+
`Domain Driven Design: Tackling Complexity in the Heart of Software`.
66+
This has already been done using java and a C# version is also available.
67+
The sample is not meant to be as the one and only way. It should help you understand the theory
68+
and gives you a starting point. Also see the [Caveats](http://dddsample.sourceforge.net/) of the
69+
java implementation. The same applies for our version.
70+
71+
Iterative Implementation
72+
------------------------
73+
To go with you when you read the book, our sample has a [release of each chapter](https://github.com/codeliner/php-ddd-cargo-sample#chapter-overview). So you can
74+
simply `git checkout ChapterOne` and you only get the starting view of the domain
75+
with just to entities `Cargo` and `Voyage`. Our application evolves chapter by chapter
76+
the more knowledge we get about the domain. You can find a list of all available chapters below.
77+
78+
Behavior Driven Design
79+
----------------------
80+
All features of the application are described in feature files. You can find them in
81+
the [features folder](https://github.com/codeliner/php-ddd-cargo-sample/tree/master/features) of the project.
82+
We make use of [Behat](http://behat.org/) and [Mink](http://mink.behat.org/) to test our
83+
business expectations.
84+
85+
Unit Tests
86+
----------
87+
Unit Tests are of course also available. You can find them in the [application module](https://github.com/codeliner/php-ddd-cargo-sample/tree/master/module/Application/tests).
88+
89+
Project Structure
90+
-----------------
91+
There is no problem if you don't know the structure of a ZF2 application. All the important
92+
parts like the domain and the infrastructure implementation can be found in the [namespace](https://github.com/codeliner/php-ddd-cargo-sample/tree/master/module/Application/src/Application) of the application module.
93+
94+
Chapter Overview
95+
----------------
96+
97+
Support
98+
-------
99+
If you have any problems with the application please let me know and send me an email `kontakt[at]codeliner[dot]ws`.
100+

0 commit comments

Comments
 (0)