It includes implementations for both event publishing and command dispatching, leveraging the Symfony Messenger infrastructure to manage asynchronous messaging and event handling.
Install
composer require bundle-bus/eventhub-craftUsage
$handler = new SumCommandHandler();
$messageBusInterface = new MessageBus([
new HandleMessageMiddleware(new HandlersLocator([
SumCommand::class => [$handler],
])),
]);
$CommandBus = new SymfonyCommandBus($messageBusInterface);
$responseSum = $CommandBus->dispatch(new SumCommand(...[1, 2, 3]));