Download the PHP package complex-heart/domain-model without Composer
On this page you can find all versions of the php package complex-heart/domain-model. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download complex-heart/domain-model
More information about complex-heart/domain-model
Files in complex-heart/domain-model
Package domain-model
Short Description Domain model toolset to properly build Value Objects, Entities and Aggregates.
License MIT
Informations about the package domain-model
Domain Model
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:
HasAttributesProvide some functionality to manage attributes.HasEqualityProvide functionality to handle equality between objects.HasInvariantsAllow invariant checking on instantiation (Guard Clause).HasIdentityDefine the Entity/Aggregate identity.HasDomainEventsProvide domain event management.
On top of those base traits Complex Heart provide ready to use compositions:
IsModelcomposed byHasAttributesandHasInvariants.IsValueObjectcomposed byIsModelandHasEquality.IsEntitycomposed byIsModel,HasIdentity,HasEquality.IsAggregatecomposed byIsEntity,HasDomainEvents.
Key Features
- Type-Safe Factory Method: The
make()static factory validates constructor parameters at runtime with clear error messages - Automatic Invariant Checking: When using
make(), Value Objects and Entities automatically validate invariants after construction (no manual$this->check()needed) - Named Parameter Support: Full support for PHP 8.0+ named parameters for improved readability and flexibility
- Union Type Support: Complete support for PHP 8.0+ union types (e.g.,
int|float,string|null) - Readonly Properties Support: Full compatibility with PHP 8.1+ readonly properties
- PHPStan Level 8: Complete static analysis support
Note: Automatic invariant checking only works when using the
make()factory method. Direct constructor calls require manual$this->check()in the constructor.
For more information and usage examples, please check the wiki.
All versions of domain-model with dependencies
ext-json Version *
ramsey/uuid Version ^4.1.0
nesbot/carbon Version ^3.2.0
illuminate/collections Version ^11.0.0 || ^12.0.0
lambdish/phunctional Version ^2.1.0
doctrine/instantiator Version ^2.0.0
complex-heart/contracts Version ^3.0.0