Simple Command Bus
NOTE: This library still under development (tests are not yet included). Use it at your own risk.
Bus has been inspired by both of those libraries but it moves away from the
due to the function of a
Command object. The object in other libraries work as a mere
data object, and that IMO is
Message should be, I understand
Message, getting the data that
requires to be executed from it. So, this library has the following characteristics:
- It handles
Messageis processed by exactly one
- The library is extensible by
strategies. Currently supporting
ExecuteStrategy(simple locate and execute), and
MiddlewareStrategy(supporting middleware pattern). New
strategiescan be easily implemented.
- The behavior of the
MiddlewareStrategyis also extensible. New
middlewarescan be added to the
middleware strategy, so
messagescan be handled the way you wish. Middlewares do things before (see
LockingMiddleware) and/or after (see
LogginMiddleware) handling a command.
We have added some development tools for you to contribute to the library with clean code:
- PHP mess detector: Takes a given PHP source code base and look for several potential problems within that source.
- PHP code fixer: Analyzes some PHP source code and tries to fix coding standards issues.
And you should use them in that order.
Sample with all options available:
./vendor/bin/phpmd ./src text codesize,unusedcode,naming,design,controversial,cleancode
./vendor/bin/phpcs -s --report=source --standard=PSR2 ./src
We have added a PHP code fixer to standardize our code. It includes Symfony, PSR2 and some contributors rules.
./vendor/bin/php-cs-fixer --config-file=.php_cs fix ./src