PHP Classes

Complex Heart PHP Domain Driven Design Model: Value objects, entities and aggregates with traits

Recommend this page to a friend!
  Info   View files Documentation   View files View files (51)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog (1)    
Last Updated Ratings Unique User Downloads Download Rankings
2024-01-30 (2 months ago) RSS 2.0 feedNot enough user ratingsTotal: 57 This week: 3All time: 10,517 This week: 30Up
Version License PHP version Categories
ch-domain-model 1.0Custom (specified...8.1Data types, Design Patterns, PHP 8
Description 

Author

This package allows the implementation of value objects, entities, and aggregates using traits.

It provides classes and traits to implement domain-driven, design-based applications.

Currently, it also provides a set of traits that can be used to define the classes:

- HasAttributes

- HasDomainEvents

- HasEquality

- HasIdentity

- HasImmutability

- HasInvariants

- HasTypeCheck

It also provides classes to implement common types of value objects that use the traits above:

- ArrayValue

- BooleanValue

- EnumValue

- FloatValue

- IntegerValue

- StringValue

- UUIDValue

Innovation Award
PHP Programming Innovation award winner
February 2024
Winner
Domain-driven design is a software design approach that aims to match the domain of the problems that the applications should solve based on the input of the experts who understand the domain of the issues.

For instance, if a software project aims to solve e-commerce problems using domain-driven design, developers should model the implementation of the product using the experience of the e-commerce experts.

This package helps implement projects that use the domain-driven design to develop value objects, entities, and aggregates using value object classes and traits provided within this package.

Manuel Lemos
Picture of Unay Santisteban
  Performance   Level  
Innovation award
Innovation award
Nominee: 3x

Winner: 1x

 

Documentation

Domain Model

Tests Quality Gate Status Coverage

Modeling Aggregates, Entities and Value Objects

Complex Heart allows you to model your domain Aggregates, Entities, and Value Objects using a set of traits. Great, but why traits and not classes? Well, sometimes you have some kind of inheritance in your classes. Being forced to use a certain base class is too invasive and personally, I don't like it. By using a set of traits and interfaces you have all the functionality you need without compromising the essence of your own domain.

The available traits are:

  • `HasAttributes` Provide some functionality to manage attributes.
  • `HasEquality` Provide functionality to handle equality between objects.
  • `HasInvariants` Allow invariant checking on instantiation (Guard Clause).
  • `HasIdentity` Define the Entity/Aggregate identity.
  • `HasDomainEvents` Provide domain event management.

On top of those base traits Complex Heart provide ready to use compositions:

  • `IsModel` composed by `HasAttributes` and `HasInvariants`.
  • `IsValueObject` composed by `IsModel` and `HasEquality`.
  • `IsEntity` composed by `IsModel`, `HasIdentity`, `HasEquality`.
  • `IsAggregate` composed by `IsEntity`, `HasDomainEvents`.

For more information please check the wiki.


  Files folder image Files  
File Role Description
Files folder image.github (1 file, 2 directories)
Files folder imagesrc (5 files, 4 directories)
Files folder imagetests (5 files, 1 directory)
Files folder imagewiki (3 files)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file sonar-project.properties Data Auxiliary data

 Version Control Unique User Downloads Download Rankings  
 100%
Total:57
This week:3
All time:10,517
This week:30Up