PHP code example of matthis / chief

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

    

matthis / chief example snippets


 

$commandBus = new matthis\Chief\CommandBus();

$myCommand = new RegisterUserCommand('John Doe', '[email protected]');
$commandBus->execute($myCommand);



class RegisterUserCommand
    public function __construct($username, $email)
    {
        $this->username = $username;
        $this->email = $email;
    }
}



class RegisterUserCommandHandler
{
    public function handle($command)
    {
        $command->username; //John Doe
        $command->email; //[email protected]
    }
}