2017 © Pedro PelĂĄez
 

library pipeline

Compose sequence of operations, immutable without side-effects

image

sergiors/pipeline

Compose sequence of operations, immutable without side-effects

  • Wednesday, April 19, 2017
  • by sergiors
  • Repository
  • 2 Watchers
  • 15 Stars
  • 19 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Pipeline

Scrutinizer Code Quality Code Coverage Build Status, (*1)

Install

composer require sergiors/pipeline

How to use

use Sergiors\Pipeline\Pipeline;

$pipeline = (new Pipeline)
    ->pipe(function ($payload) {
        return $payload + 2;
    })
    ->pipe(function ($payload) {
        return $payload * 2;
    });

echo $pipeline(10); // => 24
// echo $pipeline->process(10);
$pipeline = (new Pipeline)
    ->pipe(function ($payload, $container) {
        ...
    })
    ->pipe(function ($payload, $container) {
        ...
    });

$container = ...;
$pipeline(10, $container);

You can use Sergiors\Pipeline\Reduce, Sergiors\Pipeline\Filter and Sergiors\Pipeline\Map to compose the pipeline more readable., (*2)

use Sergiors\Pipeline\Pipeline;
use Sergiors\Pipeline\Filter;

$getOrgs = (new Pipeline)
    ->pipe(new Filter(function ($org) {
        return $org instanceof OrgInterface;
    }));

// an array with OrgInterface and UserInterface objects
$users = [...];

print_r($getOrgs($users));

Motivation

Collection Pipeline, (*3)

License

MIT, (*4)

The Versions

19/04 2017

dev-master

9999999-dev

Compose sequence of operations, immutable without side-effects

  Sources   Download

MIT

The Requires

  • php ^7.0

 

The Development Requires

by Sérgio Rafael Siqueira

19/04 2017

2.0.0

2.0.0.0

Compose sequence of operations, immutable without side-effects

  Sources   Download

MIT

The Requires

  • php ^7.0

 

The Development Requires

by Sérgio Rafael Siqueira

01/07 2016

1.0.0

1.0.0.0

Compose sequence of operations, immutable without side-effects

  Sources   Download

MIT

The Requires

  • php ^5.5|^7.0

 

The Development Requires

by Sérgio Rafael Siqueira