PHP code example of grupocoqueiro / command-bus

1. Go to this page and download the library: Download grupocoqueiro/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/ */

    

grupocoqueiro / command-bus example snippets


class Mapping implements MappingInterface
 {
     public function __invoke(): array
     {
         return [
            Command::class => CommandHandler::class
         ];
     }
 };
 
 $mapping = new Mapping();
 $container = new SomeImplementationContainerInterface();
 
 $commandBus = new CommandBusTacticianAdapter($mapping, $container);
 
 ...
 
 $commandBus->handle(new Command($something));