open-solid / domain-event-bundle
Symfony bundle for domain events
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=8.2
- open-solid/domain-event: ^1.0
- symfony/framework-bundle: ^6.4|^7.0
Requires (Dev)
- symfony/messenger: ^7.0
README
A Symfony bundle for handling domain events (https://github.com/open-solid/domain-event).
Installation
$ composer require open-solid/domain-event-bundle
Usage
use OpenSolid\DomainEvent\DomainEvent; use OpenSolid\DomainEventBundle\Attribute\AsDomainEventSubscriber; class UserRegistered extends DomainEvent { } #[AsDomainEventSubscriber] class UserRegisteredHandler { public function __invoke(UserRegistered $event): void { // Handle the event } } class UserService { public function __construct(private DomainEventPublisher $publisher) { } public function registerUser(): void { // Register the user $this->publisher->publish(new UserRegistered('uuid')); } }
License
This software is published under the MIT License