Download the PHP package blacksmith-project/command-bus without Composer
On this page you can find all versions of the php package blacksmith-project/command-bus. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package command-bus
BlacksmithProject - CommandBus
Why ?
In order to improve my skills, I'm doing my own implementation of a CommandBus.
Installation
composer require blacksmith-project/command-bus
How to set it up?
-
Your handlers need to
- be callable (implements an
__invoke()
method). - be named after the command they handle:
- be callable (implements an
-
Handlers must be added to a
CommandHandlerMap
: - Your
CommandBus
takes as parameter aCommandHandlerMap
.
How to do this in Symfony ?
- Declare your Handlers as a Service.
- Tag them with a specific tag such as
my_app.command_handler
. - Declare your
CommandHandlerMap
as a Service. - Make it use the tagged
my_app.command_handler
services as arguments. - Declare your
CommandBus
as a Service. - Make it use the
CommandHandlerMap
as argument.
Example:
How to use it?
Now, you only need to inject your CommandBus
and execute commands.
Example:
All versions of command-bus with dependencies
PHP Build Version
Package Version
Requires
php Version
^7.3
The package blacksmith-project/command-bus contains the following files
Loading the files please wait ....