phpgears / cqrs-symfony-messenger
CQRS implementation with Symfony's Messenger
Installs: 3 504
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- php: ^7.1
- phpgears/cqrs: ~0.3.1
- symfony/messenger: ^4.3
Requires (Dev)
- brainmaestro/composer-git-hooks: ^2.1
- friendsofphp/php-cs-fixer: ^2.0
- infection/infection: ^0.9
- phpmd/phpmd: ^2.0
- phpstan/extension-installer: ^1.0
- phpstan/phpstan: ~0.11.12
- phpstan/phpstan-deprecation-rules: ~0.11.2
- phpstan/phpstan-strict-rules: ~0.11.1
- phpunit/phpunit: ^7.0|^8.0
- povils/phpmnd: ^2.0
- roave/security-advisories: dev-master
- sebastian/phpcpd: ^4.0
- squizlabs/php_codesniffer: ^3.0
- thecodingmachine/phpstan-strict-rules: ~0.11.2
This package is auto-updated.
Last update: 2024-11-25 07:03:08 UTC
README
CQRS with Symfony's Messenger
CQRS implementation with Symfony's Messenger
Installation
Composer
composer require phpgears/cqrs-symfony-messenger
Usage
Require composer autoload file
require './vendor/autoload.php';
Commands Bus
use Gears\CQRS\Symfony\Messenger\CommandBus; use Gears\CQRS\Symfony\Messenger\CommandHandlerLocator; use Symfony\Component\Messenger\MessageBus; use Symfony\Component\Messenger\Middleware\HandleMessageMiddleware; $commandToHandlerMap = []; $messengerBus = new MessageBus([ new HandleMessageMiddleware(new CommandHandlerLocator($commandToHandlerMap)), ]); $commandBus = new CommandBus($messengerBus); /** @var \Gears\CQRS\Command $command */ $commandBus->handle($command);
Query Bus
use Gears\CQRS\Symfony\Messenger\QueryBus; use Gears\CQRS\Symfony\Messenger\QueryHandlerLocator; use Symfony\Component\Messenger\MessageBus; use Symfony\Component\Messenger\Middleware\HandleMessageMiddleware; $queryToHandlerMap = []; $messengerBus = new MessageBus([ new HandleMessageMiddleware(new QueryHandlerLocator($queryToHandlerMap)), ]); $queryBus = new QueryBus($messengerBus); /** @var \Gears\CQRS\Command $query */ $result = $queryBus->handle($query);
Contributing
Found a bug or have a feature request? Please open a new issue. Have a look at existing issues before.
See file CONTRIBUTING.md
License
See file LICENSE included with the source code for a copy of the license terms.