PHPackages                             gandung/pipeline - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. gandung/pipeline

ActiveLibrary

gandung/pipeline
================

A PHP package to invoke parallel closure or invokable class instance

v1.0.0(8y ago)020BSD-3-ClausePHP

Since Oct 11Pushed 8y ago1 watchersCompare

[ Source](https://github.com/plvhx/pipeline)[ Packagist](https://packagist.org/packages/gandung/pipeline)[ RSS](/packages/gandung-pipeline/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (1)Versions (3)Used By (0)

Pipeline
========

[](#pipeline)

[![Build status](https://camo.githubusercontent.com/2ececc055e4a0d920406afef3b3480a88e7bec99f414a9a418fea267d8e32b92/68747470733a2f2f63692e6170707665796f722e636f6d2f6170692f70726f6a656374732f7374617475732f6e6b38336771356e686131763961626a3f7376673d74727565)](https://ci.appveyor.com/project/plvhx/pipeline)[![SensioLabsInsight](https://camo.githubusercontent.com/07f221310bd1d974c1db2d3679255ccce7e12d98c3d91999accf6dd47a90e433/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f36393437356530302d393164362d343462302d386230622d3861333361356238353365622f6d696e692e706e67)](https://insight.sensiolabs.com/projects/69475e00-91d6-44b0-8b0b-8a33a5b853eb)

This library provides ability to run callbacks/closure/invokable instance in parallel.

Table Of Content
================

[](#table-of-content)

- [Quick Start](#quick-start)
- [API](#api)
    - [Pipeline](#pipeline-1)
    - [PipelineBuilder](#pipelinebuilder)
    - [Processor](#processor)
    - [InterruptibleProcessor](#interruptibleprocessor)
    - [IntermitProcessor](#intermitprocessor)

Quick Start
-----------

[](#quick-start)

### Pipe several tasks and immediately run it in parallel.

[](#pipe-several-tasks-and-immediately-run-it-in-parallel)

```
use Gandung\Pipeline\Pipeline;

// Closure based task.
$pipe = (new Pipeline)
	->pipe(function($q) { return $q; })
	->pipe(function($q) { return join(' ', [$q, 'bar']); })
	->pipe(function($q) { return join(' ', [$q, 'baz']); });
$payload = $pipe->invokeAll('foo');

echo sprintf("%s\n", $payload);
```

This will print `'foo bar baz'`. This equals to `$task3($task2($task1('foo')))`.

```
use Gandung\Pipeline\Pipeline;
use Gandung\Pipeline\Tests\Fixtures\FooTask;
use Gandung\Pipeline\Tests\Fixtures\BarTask;
use Gandung\Pipeline\Tests\Fixtures\BazTask;

// Instance based task. Class instance must implements __invoke and TaskInterface class interface.
$pipe = (new Pipeline)
	->pipe(new FooTask)
	->pipe(new BarTask)
	->pipe(new BazTask);
$payload = $pipe->invokeAll('foo');

echo sprintf("%s\n", $payload);
```

This will print the same result as above.

### Build tasks first, then run.

[](#build-tasks-first-then-run)

```
use Gandung\Pipeline\PipelineBuilder;

// Closure based task.
$builder = (new PipelineBuilder)
	->add(function($q) { return $q; })
	->add(function($q) { return join(' ', [$q, 'bar']); })
	->add(function($q) { return join(' ', [$q, 'baz']); });
$pipe = $builder->build();
$payload = $pipe->invokeAll('foo');

echo sprintf("%s\n", $payload);
```

```
use Gandung\Pipeline\PipelineBuilder;
use Gandung\Pipeline\Tests\Fixtures\FooTask;
use Gandung\Pipeline\Tests\Fixtures\BarTask;
use Gandung\Pipeline\Tests\Fixtures\BazTask;

// Instance based task. Class instance must implements __invoke and TaskInterface class interface.
$builder = (new PipelineBuilder)
	->add(new FooTask)
	->add(new BarTask)
	->add(new BazTask);
$pipe = $builder->build();
$payload = $pipe->invokeAll('foo');

echo sprintf("%s\n", $payload);
```

API
===

[](#api)

Pipeline
--------

[](#pipeline-1)

`__construct($tasks = [], ProcessorInterface $processor = null)`

#### Parameter

[](#parameter)

- `$tasks` The tasks, can be list of closure/class instance, defaulting to empty array
- `\Gandung\Pipeline\ProcessorInterface $processor` The class instance which implements `ProcessorInterface`, defaulting to `null`

#### Return Value

[](#return-value)

None

`pipe($task)`

#### Parameter

[](#parameter-1)

- `$task` The task, can be closure/class instance

#### Return Value

[](#return-value-1)

An immutable copy of `\Gandung\Pipeline\Pipeline`

`invokeAll($param)`

#### Parameter

[](#parameter-2)

- `$param` Task parameter

#### Return Value

[](#return-value-2)

Mixed

PipelineBuilder
---------------

[](#pipelinebuilder)

`add($task)`

#### Parameter

[](#parameter-3)

- `$task` The task, can be closure/class instance

#### Return Value

[](#return-value-3)

An immutable copy of `Gandung\Pipeline\PipelineBuilder`

`build(ProcessorInterface $processor = null)`

#### Parameter

[](#parameter-4)

- `\Gandung\Pipeline\ProcessorInterface $processor` The class instance which implements `ProcessorInterface`, defaulting to `null`

#### Return Value

[](#return-value-4)

An instance of `\Gandung\Pipeline\Pipeline`

Processor
---------

[](#processor)

`invoke($tasks, $param)`

#### Parameter

[](#parameter-5)

- `$tasks` The tasks, can be list of closure/class instance
- `$param` Task parameter

#### Return Value

[](#return-value-5)

Mixed

`resume()`

#### Parameter

[](#parameter-6)

None

#### Return Value

[](#return-value-6)

None

`freeze()`

#### Parameter

[](#parameter-7)

None

#### Return Value

[](#return-value-7)

None

`interrupt()`

#### Parameter

[](#parameter-8)

None

#### Return Value

[](#return-value-8)

None

`pause()`

#### Parameter

[](#parameter-9)

None

#### Return Value

[](#return-value-9)

None

`getState()`

#### Parameter

[](#parameter-10)

None

#### Return Value

[](#return-value-10)

Current task state.

InterruptibleProcessor
----------------------

[](#interruptibleprocessor)

`__construct($routine)`

#### Parameter

[](#parameter-11)

- `$routine` Cancellation routine, must return `true` or `false`

#### Return Value

[](#return-value-11)

None

`invoke($tasks, $param)`

#### Parameter

[](#parameter-12)

- `$tasks` The tasks, can be list of closure/class instance
- `$param` Task parameter

#### Return Value

[](#return-value-12)

Mixed

`resume()`

#### Parameter

[](#parameter-13)

None

#### Return Value

[](#return-value-13)

None

`freeze()`

#### Parameter

[](#parameter-14)

None

#### Return Value

[](#return-value-14)

None

`interrupt()`

#### Parameter

[](#parameter-15)

None

#### Return Value

[](#return-value-15)

None

`pause()`

#### Parameter

[](#parameter-16)

None

#### Return Value

[](#return-value-16)

None

`getState()`

#### Parameter

[](#parameter-17)

None

#### Return Value

[](#return-value-17)

Current task state.

IntermitProcessor
-----------------

[](#intermitprocessor)

`__construct($routine = null)`

#### Parameter

[](#parameter-18)

- `$routine` Cancellation routine, must return `true` or `false`, defaulting to `null`

#### Return Value

[](#return-value-18)

None

`invoke($tasks, $param)`

#### Parameter

[](#parameter-19)

- `$tasks` The tasks, can be list of closure/class instance
- `$param` Task parameter

#### Return Value

[](#return-value-19)

Mixed

`resume()`

#### Parameter

[](#parameter-20)

None

#### Return Value

[](#return-value-20)

None

`pause()`

#### Parameter

[](#parameter-21)

None

#### Return Value

[](#return-value-21)

None

`interrupt()`

#### Parameter

[](#parameter-22)

None

#### Return Value

[](#return-value-22)

None

`freeze()`

#### Parameter

[](#parameter-23)

None

#### Return Value

[](#return-value-23)

None

`getState()`

#### Parameter

[](#parameter-24)

None

#### Return Value

[](#return-value-24)

Current task state.

###  Health Score

27

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3085d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e1b54fcf07f817bc79b2aa1f4416a29d74e1bf461f0b7fe2804762402b83b935?d=identicon)[gandung](/maintainers/gandung)

---

Top Contributors

[![plvhx](https://avatars.githubusercontent.com/u/12740518?v=4)](https://github.com/plvhx "plvhx (13 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/gandung-pipeline/health.svg)

```
[![Health](https://phpackages.com/badges/gandung-pipeline/health.svg)](https://phpackages.com/packages/gandung-pipeline)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
