PHP code example of klc / data-chain
1. Go to this page and download the library: Download klc/data-chain 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/ */
klc / data-chain example snippets
KLC\DataChain;
class AChain extends DataChain {
protected function handle(array $params)
{
return false;
}
protected function terminate(array $params, $result)
{
return $result;
}
}
class BChain extends DataChain {
protected function handle(array $params)
{
return false;
}
protected function terminate(array $params, $result)
{
return $result;
}
}
class CChain extends DataChain {
protected function handle(array $params)
{
return $params['hello_world'];
}
}
$aChain = new AChain();
$bChain = new BChain();
$cChain = new CChain();
$aChain->next($bChain)->next($cChain);
echo $aChain->run(['hello_world' => 'Hello World']);