cherif/yii2-tactician
最新稳定版本:0.3
Composer 安装命令:
composer require cherif/yii2-tactician
包简介
Yii2 component for Tactician command bus library
README 文档
README
Tactician command bus library wrapper for Yii2
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist cherif/yii2-tactician "*"
or add
"cherif/yii2-tactician": "*"
to the require section of your composer.json file.
Usage
In the configuration file the component must be in the application bootstrap configuration:
... 'components'=>[ ... 'commandBus'=> [ 'class'=>'cherif\tactician\Tactician', 'inflector' => 'League\Tactician\Handler\MethodNameInflector\HandleClassNameInflector', 'extractor' => 'League\Tactician\Handler\CommandNameExtractor\ClassNameExtractor', 'commandHandlerMap'=> [ 'cherif\tactician\tests\fixtures\commands\CompleteTaskCommand' => 'cherif\tactician\tests\fixtures\handlers\CompleteTaskCommandHandler', ] ] ]
Somewhere in your app (maybe controller):
Yii:$app->commandBus->handle(new CompleteTaskCommand)
You can add additional middlewares before handling a command like this:
$middleware = new MiddlewareClass(); $command = new MyCommand(); Yii::$app->commandBus->registerMiddleware($middleware); Yii::$app->commandBus->handle($command);
For more information about configuration please visit Tactician library homepage.
统计信息
- 总下载量: 1.79k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 20
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2015-09-13