runner/pipeline

v0.1.0 2018-12-28 08:14 UTC

This package is auto-updated.

Last update: 2024-11-29 05:38:44 UTC


README

Pipeline Like Laravel

StyleCI

Usage

<?php

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;
});