PHP code example of commander / core

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

    

commander / core example snippets


$commander = new Commander();
$this->commander->get('/user/{id}', 'user.cache.get', SimpleGetUserHandler::class);
$commander->run();


//In SimpleGetUserHandler
class SimpleGetUserHandler extends Handler
{
    /**
     * @param CommandInterface $command
     */
    public function handle(CommandInterface $command)
    {
        $this->eventBus->notify(CompletedEvent::makeEvent(['id' => '1'])); //fill in the user info
    }
}