gember / message-bus-symfony
Gember Event Sourcing Message Bus adapter based on symfony/messenger
dev-main
2024-10-13 12:16 UTC
Requires
- php: ^8.3
- gember/event-sourcing: dev-main
- symfony/messenger: ^7.1
Requires (Dev)
- captainhook/captainhook: ^5.23
- friendsofphp/php-cs-fixer: ^3.58
- phpstan/phpstan: ^1.11
- phpunit/phpunit: ^11.1
- rector/rector: ^1.2
- rregeer/phpunit-coverage-check: ^0.3.1
- shipmonk/composer-dependency-analyser: ^1.5
- symfony/property-access: ^7.0
This package is auto-updated.
Last update: 2024-12-13 12:39:35 UTC
README
Gember Event Sourcing Message Bus adapter based on symfony/messenger.
All external dependencies in Gember Event Sourcing are organized into separate packages, making it easy to swap out a vendor adapter for another.
Installation
Install with Composer:
composer gember/message-bus-symfony
Configuration
Bind this adapter to the EventBus
interface in your service definitions.
Examples
Vanilla PHP
use Gember\MessageBusSymfony\SymfonyEventBus; use Symfony\Component\Messenger\Handler\HandlersLocator; use Symfony\Component\Messenger\MessageBus; use Symfony\Component\Messenger\Middleware\HandleMessageMiddleware; $finder = new SymfonyEventBus( new MessageBus([ // An EventBus configuration of your choice new HandleMessageMiddleware(new HandlersLocator([ SomeEvent::class => [SomeEventSubscriber::class], // ... ])), ]), );
Symfony
It is recommended to use the Symfony bundle to configure Gember Event Sourcing. With this bundle, the adapter is automatically set as the default for Event Bus.
If you're not using the bundle, you can bind it directly to the EventBus
interface.
Gember\EventSourcing\Util\Messaging\MessageBus\EventBus: class: Gember\MessageBusSymfony\SymfonyEventBus arguments: - '@event.bus' # or any other defined Symfony event bus