Download the PHP package complex-heart/domain-events without Composer
On this page you can find all versions of the php package complex-heart/domain-events. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download complex-heart/domain-events
More information about complex-heart/domain-events
Files in complex-heart/domain-events
Package domain-events
Short Description Domain event toolset for building rich domain events.
License MIT
Informations about the package domain-events
Domain Events
Building Rich Domain Events
Complex Heart Domain Events provides a trait-based implementation of the Event contract from
php-contracts. It auto-generates event metadata so you can focus on
defining what happened in your domain without boilerplate.
The available trait:
IsDomainEventImplements theEventcontract with auto-generatedeventId,eventName,payload, andoccurredOn.
Key Features
- Auto-Generated Event ID: Each event instance gets a unique UUID v4 identifier
- Convention-Based Event Name: Derives a dotted event name from the class name (
OrderPlaced→order.placed) - Automatic Payload: Builds the payload from public properties via reflection
- ISO-8601 Timestamps: Records when the event occurred
- Factory Method: Uses
new()/make()static factories consistent with the ComplexHeart ecosystem - Framework Agnostic: Pure PHP, no framework dependencies — works with Laravel, Symfony, or standalone
- PHPStan Level 8: Complete static analysis support
Installation
Usage
Define your domain events as simple final classes with public readonly properties:
Create events using the static factory:
Integration with Aggregates
Domain events are designed to work with aggregates that use the HasDomainEvents trait from
php-domain-model:
Then publish events through an EventBus implementation in your use case:
For more information and usage examples, please check the wiki.