grupocoqueiro / command-bus
此包已被弃用且不再维护。未建议替代包。
命令总线适配器
v1.2.1
2021-08-10 12:28 UTC
Requires
- php: ^7.1||^8.0
- league/tactician: ^1.0
- league/tactician-container: ^2.0
Requires (Dev)
- filp/whoops: 2.*
- phpunit/phpunit: ^7.1||^9.0
This package is auto-updated.
Last update: 2021-08-10 12:40:28 UTC
README
Tactician命令总线的适配器
安装
使用composer: composer require grupocoqueiro/command-bus
如何使用
- 创建一个实现
GrupoCoqueiro\CommandBus\MappingInterface
的类 - 使用实现
Psr\Container\ContainerInterface
的容器服务
示例
class Mapping implements MappingInterface { public function __invoke(): array { return [ Command::class => CommandHandler::class ]; } }; $mapping = new Mapping(); $container = new SomeImplementationContainerInterface(); $commandBus = new CommandBusTacticianAdapter($mapping, $container); ... $commandBus->handle(new Command($something));