定制 robotusers/commander 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

robotusers/commander

最新稳定版本:0.3.0

Composer 安装命令:

composer require robotusers/commander

包简介

Command Bus abstraction for PHP.

README 文档

README

Software License Build Status codecov

Command Bus abstraction for PHP.

Installation

composer require robotusers/commander

Command Bus abstraction

This library provides a CommandBusInterface which a command bus should implement.

Using the command bus

use Robotusers\Commander\CommandBusAwareInterface;
use Robotusers\Commander\CommandBusAwareTrait;

class OrdersController implements CommandBusAwareInterface
{
   use CommandBusAwareTrait;

   public function makeOrder()
   {
        ...
        $command = new MakeOrderCommand($data);
        $this->handleCommand($command);
        ...
   }

}

Adapters

The library provides adapters for the most common command bus implementations.

Tactician

composer require league/tactician
use League\Tactician\CommandBus;
use Robotusers\Commander\Adapter\TacticianAdapter;

$commandBus = new CommandBus($middleware);
$adapter = new TacticianAdapter($commandBus);

$controller->setCommandBus($adapter);

SimpleBus/MessageBus

composer require simple-bus/message-bus
use Robotusers\Commander\Adapter\SimpleBusAdapter;
use SimpleBus\Message\Bus\Middleware\MessageBusSupportingMiddleware;

$commandBus = new MessageBusSupportingMiddleware();
$adapter = new SimpleBusAdapter($commandBus);

$controller->setCommandBus($adapter);

PSB - ProophServiceBus

composer require prooph/service-bus
use Prooph\ServiceBus\CommandBus;
use Robotusers\Commander\Adapter\ServiceBusAdapter;

$commandBus = new CommandBus();
$adapter = new ServiceBusAdapter($commandBus);

$controller->setCommandBus($adapter);

Writing a custom adapter

You can write your custom adapter. The adapter must implement Robotusers\Commander\CommandBusInterface.

class MyAdapter implements CommandBusInterface
{
    public function handle($command)
    {
        //handle a command
    }
}

统计信息

  • 总下载量: 98.75k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 1

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-07-24