PHP code example of runner / pipeline
1. Go to this page and download the library: Download runner/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/ */
runner / pipeline example snippets
use Runner\Pipeline\Pipeline;
$pipeline = new Pipeline();
$a = function ($payload, $next) {
echo 'a' . PHP_EOL;
return $next($payload);
};
$b = function ($payload, $next) {
echo 'b' . PHP_EOL;
return $next($payload);
};
$c = new class{
public function handle($payload, $next)
{
echo 'c' . PHP_EOL;
return $next($payload);
}
};
$pipeline->pipe($a)->pipe($b)->pipe($c)->method('handle')->payload(1)->process(function ($payload) {
return $payload * 20;
});