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