trntv/yii2-tactician A simple, flexible command bus. This package provide it's integration with Yii2

extension

Yii2 Tactician

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([
        ...
    ])
])

Statistics

Downloads
GitHub Stars
GitHub Forks

Releases

Comments



1.0.1 is the latest of 4 releases



BSD-3-Clause license
Stats
14 github stars & 4 github forks
2 downloads in the last day
62 downloads in the last 30 days
9352 total downloads