trntv/yii2-tactician
最新稳定版本:1.0.1
Composer 安装命令:
composer require trntv/yii2-tactician
包简介
A simple, flexible command bus. This package provide it's integration with Yii2
关键字:
README 文档
README
Tactician is a simple, flexible package allows you to easy implement Command Bus pattern in your application. This package provide it's very basic integration with Yii2
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require trntv/yii2-tactician
or add
"trntv/yii2-tactician": "*"
to the require section of your composer.json file.
Usage
Somewhere in your config:
'components' => [ ... 'commandBus' => [ 'class' => '\trntv\tactician\Tactician', 'commandNameExtractor' => '\League\Tactician\Handler\CommandNameExtractor\ClassNameExtractor' 'methodNameInflector' => '\League\Tactician\Handler\MethodNameInflector\HandleInflector' 'commandToHandlerMap' => [ 'app\commands\command\SendEmailCommand' => 'app\commands\handler\SendEmailHandler' ], 'middlewares' => [ ... ] ] ... ]
Somewhere in your app:
Yii::$app->commandBus->handle(new SendEmailCommand([ 'from' => 'email@example.org', 'to' => 'user@example.org', 'body' => '...' ])) Yii::$app->commandBus->handleMultiply([ new SendEmailCommand([ 'from' => 'email@example.org', 'to' => 'user@example.org', 'body' => '...' ]), new SomeOtherCommand([ ... ]) ])
统计信息
- 总下载量: 56.51k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 14
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2015-06-01