PHP code example of wyrihaximus / tactician-command-handler-mapper

1. Go to this page and download the library: Download wyrihaximus/tactician-command-handler-mapper 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/ */

    

wyrihaximus / tactician-command-handler-mapper example snippets




namespace Test\App\Commands;

use WyriHaximus\Tactician\CommandHandler\Annotations\Handler;

/**
 * @Handler("Test\App\Handlers\AwesomesauceHandler")
 */
class AwesomesauceCommand
{
    /**
     * @var string
     */
    private $value;

    /**
     * AwesomesauceCommand constructor.
     * @param string $value
     */
    public function __construct($value)
    {
        $this->value = $value;
    }

    /**
     * @return string
     */
    public function getValue()
    {
        return $this->value;
    }
}

use League\Tactician\Setup\QuickStart;
use WyriHaximus\Tactician\CommandHandler\Mapper;

$commandBus = QuickStart::create(
    Mapper::mapInstanciated('src' . DS . 'CommandBus')
);

use League\Tactician\Setup\QuickStart;

$commandToHandlerMap = Mapper::map('src' . DS . 'CommandBus');