PHP code example of ehough / chaingang
1. Go to this page and download the library: Download ehough/chaingang 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/ */
ehough / chaingang example snippets
/*
* Build some commands.
*/
$command1 = new MyCommand1(); //implements ehough_chaingang_api_Command
$command2 = new MyCommand2(); //implements ehough_chaingang_api_Command
/*
* Build and assemble the chain.
*/
$chain = new ehough_chaingang_impl_StandardChain();
$chain->addCommand($command1);
$chain->addCommand($command2);
/*
* Build the execution context.
*/
$context = new ehough_chaingang_impl_StandardContext();
$context->put('foo', 'bar');
/*
* Execute the chain.
*/
$successfullyHandled = $chain->execute($context);