PHP code example of innmind / command-bus
1. Go to this page and download the library: Download innmind/command-bus library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
innmind / command-bus example snippets
use function Innmind\CommandBus\bootstrap;
use Innmind\Immutable\Map;
class MyCommand {}
$echo = function(MyCommand $command) {
echo 'foo';
};
$handle = bootstrap()['bus'](
Map::of('string', 'callable')
(MyCommand::class, $echo)
);
$handle(new MyCommand); //prints 'foo' and return null;