PHP code example of pixaye / pipeliner

1. Go to this page and download the library: Download pixaye/pipeliner 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/ */

    

pixaye / pipeliner example snippets


$pipeline = new Pipeliner\Pipeline();

$pipeline->pipe(new ExampleMiddleware());
         ->pipe(new SecondExampleMiddleware());
         ->exec();



use Pipeliner\Middleware\AbstractMiddleware;

/**
 * Class ExampleMiddleware
 */
class ExampleMiddleware extends AbstractMiddleware
{
    /**
     * Doing dome stuff and returns result or null, if it is making some action and don't returns something;
     */
    public function handle()
    {
        echo 'First middleware has done some stuff';
    }
}



public function next() : ?string
{
    return 'SecondExampleMiddleware';
}


$pipeline = new Pipeliner\Pipeline();

$pipeline->pipe(new ExampleMiddleware())
         ->pipe(new SecondExampleMiddleware())
         ->pipe(new ClosureMiddleware('SomeActionName', function(){
              return 'I am clousure';
         }, 'FourthMiddleware'))
         ->pipe(new FourthMiddleware())
         ->exec();


$this->bag->put('NameOfMiddleware', $data);
$this->bag->get('NameOfMiddleware');
$this->bag->getLast();
$this->bag->getAll();

$pipeliner = new Pipeliner\Pipeline();
$pipeliner->setPipelineBag(new YourOwnBagClass());
...