grupocoqueiro/command-bus

此包已被弃用且不再维护。未建议替代包。

命令总线适配器

v1.2.1 2021-08-10 12:28 UTC

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));