matthis/chief
最新稳定版本:v1.4.0
Composer 安装命令:
composer require matthis/chief
包简介
A simple command bus
README 文档
README
A simple Command bus.
Installation
Install via composer.
composer require "matthis/chief:1.2.*"
Usage
Executing a command is as simple as:
<?php $commandBus = new matthis\Chief\CommandBus(); $myCommand = new RegisterUserCommand('John Doe', 'john@doe.com'); $commandBus->execute($myCommand);
Chief expects the following naming convention:
The commands should end with "Command".
Example command:
<?php class RegisterUserCommand public function __construct($username, $email) { $this->username = $username; $this->email = $email; } }
For Chief to map the command to a command handler the handler should have the same name as the command and have "Handler" appended to it.
Example command handler:
<?php class RegisterUserCommandHandler { public function handle($command) { $command->username; //John Doe $command->email; //john@doe.com } }
Tests
vendor/bin/phpspec run
统计信息
- 总下载量: 2.57k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-03-22