Package Data | |
---|---|
Maintainer Username: | netbulae |
Maintainer Contact: | xander@videofunk.nl (xander smalbil) |
Package Create Date: | 2015-04-02 |
Package Last Update: | 2015-04-05 |
Language: | PHP |
License: | Unknown |
Last Refreshed: | 2024-11-22 03:05:27 |
Package Statistics | |
---|---|
Total Downloads: | 6 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 4 |
Total Forks: | 0 |
Total Open Issues: | 1 |
Laravel ServiceProvider for the Tactician library https://github.com/thephpleague/tactician/
If you are looking for a Symfony2 Bundle or want to help: https://github.com/xtrasmal/TacticianBundle
First add this provider to your composer dependencies:
> composer require xtrasmal\tactician-provider
Then register it in your config/app.php.
'providers' => [
'Xtrasmal\TacticianProvider\TacticianServiceProvider',
// ...
That's it!
The most common use case with Tactician is passing a Command to the Command Bus and having it routed to the Command Bus.
Since handlers often have extra dependencies and are best lazily-loaded, you'll want to register them in the IoC container.
Let's say we have two classes, RegisterUserCommand
and RegisterUserHandler
. Add the following to config/tactician.php
return [
'buses' => [
'default' => [
'commandbus' => 'League\Tactician\CommandBus',
'middleware' => [
// ...
],
'commmands' => [
'RegisterUser' => [
'command' => 'Namespace\RegisterUserCommand',
'handler' => 'Namespace\RegisterUserHandler'
],
'RemoveUser' => [
'command' => 'Namespace\RemoveUserCommand',
'handler' => 'Namespace\RemoveUserHandler'
],
// ...
],
],
],
];