承接 smoothphp/commandbus 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

smoothphp/commandbus

最新稳定版本:v5.0.0

Composer 安装命令:

composer require smoothphp/commandbus

包简介

Smooth Php Command Bus

README 文档

README

The command bus exists to execute write-or-fail commands within the domain of the application.

The command bus exists of 4 components.

  • Command
    The DTO containing the intent and data to execute the command.
  • Command Translator
    Takes a command, and translates to the command handler class name.
  • Handler Resolver
    Resolves (generates) the object that executes the given command
  • Middleware
    Sits between CommandBus::execute() and the execution of the command. Similar to HTTP middleware.

Examples

<?php  
 
// Define as many middlewares as you like,
// the given one uses the simple translator and resolver to  
// generate the command handler
$middleware = [
    new SmoothPhp\CommandBus\CommandHandlerMiddleware(
        new SmoothPhp\CommandBus\SimpleCommandTranslator,
        new SmoothPhp\CommandBus\SimpleCommandHandlerResolver
    )
];  
  
// Create the bus with the middle ware
$bus = new SmoothPhp\CommandBus\CommandBus($middleware);  
  
// Create the command
$command = new SignUpToNewsletter($memberId, $newsletterId);  
  
// Send to command bus
$bus->execute($command);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-08-05