cherif/yii2-tactician Yii2 component for Tactician command bus library

extensioncommandtacticiancqs

Yii2 Tactician

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.

Statistics

Downloads
GitHub Stars
GitHub Forks

Releases

  • 0.314 September 2015
  • 0.214 September 2015
  • 0.113 September 2015

Comments



0.3 is the latest of 3 releases



BSD-3-Clause license
Stats
20 github stars & 2 github forks
1 downloads in the last day
3 downloads in the last 30 days
1753 total downloads