Download the PHP package innmind/command-bus-bundle without Composer
On this page you can find all versions of the php package innmind/command-bus-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download innmind/command-bus-bundle
More information about innmind/command-bus-bundle
Files in innmind/command-bus-bundle
Package command-bus-bundle
Short Description Command Bus Bundle
License MIT
Homepage http://github.com/Innmind/CommandBusBundle
Informations about the package command-bus-bundle
CommandBusBundle
master |
develop |
---|---|
Symfony integration of innmind/command-bus
that ease stacking command buses.
Installation
In your AppKernel.php
add the following line:
Usage
In order to handle your commands you need to define the handlers as services with the tag innmind_command_bus.handler
with the attribte handles
that will contain the command FQCN.
Advanced configuration
You may want to add extra capabilities to the command bus to do some specific stuff before or after each command is executed (like flushing the doctrine manager or logging each command).
To do so you need to create a class that implements CommandBusInterface
. The class must at least have one argument in its contructor type hinted with this interface.
Then you declare this command bus as a service with a tag innmind_command_bus
and an attribute alias
. Then the alias must be placed in the innminc_command_bus.stack
configuration array.
Example:
With all this each time you handle a command it will look if there's a handle being handled (in such case it will queue it; this happens if you handle a command inside a handler), then if it can be executed it will log the command (this is your class) and finally it will call the handler associated to the command.
All versions of command-bus-bundle with dependencies
symfony/http-kernel Version ~3.0
symfony/dependency-injection Version ~3.0
symfony/config Version ~3.0
innmind/command-bus Version ~2.0
symfony/yaml Version ~3.0