1. Go to this page and download the library: Download b2pweb/bdf-pipeline 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/ */
b2pweb / bdf-pipeline example snippets
use Bdf\Pipeline\Pipeline;
use Bdf\Pipeline\CallableFactory\LinkedCallableFactory;
$pipeline = new Pipeline(new LinkedCallableFactory());
$pipeline->pipe(function($value) {
return $value + 2;
});
// Returns 12
$pipeline->send(10);
use Bdf\Pipeline\Pipeline;
use Bdf\Pipeline\CallableFactory\StackCallableFactory;
$pipeline = new Pipeline(new StackCallableFactory());
$pipeline->pipe(function($next, $foo, $bar) {
// Do something
...
$result = $next($foo, $bar);
// Do something else
...
return $result;
});
$pipeline->outlet(function($foo, $bar) {
return "${foo}.${bar}";
});
// Manage multiple parameters
echo $pipeline->send('foo', 'bar'); // Print foo.bar