phpgears / cqrs-tactician
CQRS implementation with League Tactician
0.4.1
2019-10-05 11:29 UTC
Requires
- php: ^7.1
- league/tactician: ^1.0
- phpgears/cqrs: ~0.3.1
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 06:51:00 UTC
README
CQRS with Tactician
CQRS implementation with League Tactician
Installation
Composer
composer require phpgears/cqrs-tactician
Usage
Require composer autoload file
require './vendor/autoload.php';
Commands Bus
use Gears\CQRS\Tactician\CommandBus; use Gears\CQRS\Tactician\CommandHandlerMiddleware; use League\Tactician\CommandBus as TacticianBus; use League\Tactician\Handler\Locator\InMemoryLocator; use League\Tactician\Plugins\LockingMiddleware; $commandToHandlerMap = []; $tacticianBus = new TacticianBus([ new LockingMiddleware(), new CommandHandlerMiddleware(new InMemoryLocator($commandToHandlerMap)), ]); $commandBus = new CommandBus($tacticianBus); /** @var \Gears\CQRS\Command $command */ $commandBus->handle($command);
Query Bus
use Gears\CQRS\Tactician\QueryBus; use Gears\CQRS\Tactician\QueryHandlerMiddleware; use League\Tactician\CommandBus as TacticianBus; use League\Tactician\Handler\Locator\InMemoryLocator; use League\Tactician\Plugins\LockingMiddleware; $queryToHandlerMap = []; $tacticianBus = new TacticianBus([ new LockingMiddleware(), new QueryHandlerMiddleware(new InMemoryLocator($queryToHandlerMap)), ]); $queryBus = new QueryBus($tacticianBus); /** @var \Gears\CQRS\Query $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.