Download the PHP package biberlabs/ddd-embeddables without Composer
On this page you can find all versions of the php package biberlabs/ddd-embeddables. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download biberlabs/ddd-embeddables
More information about biberlabs/ddd-embeddables
Files in biberlabs/ddd-embeddables
Package ddd-embeddables
Short Description A collection of re-usable value objects ready to use as Embeddable in Doctrine entities
License MIT
Informations about the package ddd-embeddables
DDD Embeddables
A collection of reusable value objects written in PHP and targeting versions 8.0 and above. Value objects are essential building blocks of Domain Driven Design approach and described by Martin Fowler in P of EAA page 486 as below:
"Value object is a small simple object, like money or a date range, whose equality isn't based on identity."
– Martin Fowler
All classes in this library annotated as ORM\Embeddable
with appropriately adjusted column attributes. This makes them ready to use in any project with Doctrine ORM as Embeddables.
Installation & Usage
Install the library using composer.
and use it in your entities:
Afterwards, you can write custom DQL queries based on your requirements while accessing properties of the value objects such as:
Value objects enables us to write much more cleaner and readable rules when dealing with the domain rules, application-wide. For example:
or
even
Running Tests
You can run unit tests locally via issuing the command below:
Please make sure that all test are green before creating a PR.
Contributing
If you want to contribute to ddd-embeddables and make it better, your help is very welcome.
Please take a look our CONTRIBUTING.md before creating a pull request.
Further Reading
Are you interested in Domain Driven Design? Here is a list of good resources to dig in-depth.
- Value Objects - Martin Fowler
- Separating Concerns using Embeddables - Doctrine ORM documentation
- Domain-Driven Design in PHP - Leanpub 380 pages e-book.
- Agregate Componenet Pattern In Action - Another good article from 2009
- Domain Driven Design Concepts in ZF2 - An article written by Oleg Krivtsov in 2014
- Domain Driven Design Quickly - A quickly-readable minibook and introduction to the fundamentals of DDD by InfoQ.