PHPackages                             syberisle/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. syberisle/pipeline

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

syberisle/pipeline
==================

Pipeline implementation

1.0.1(5y ago)0991MITPHPPHP &gt;7.1CI passing

Since Jun 18Pushed 5y ago1 watchersCompare

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

READMEChangelog (2)Dependencies (3)Versions (4)Used By (1)

SyberIsle\\Pipeline
===================

[](#syberislepipeline)

This package provides a pipeline pattern implementation.

Pipeline Pattern
----------------

[](#pipeline-pattern)

The pipeline pattern allows you to easily compose sequential stages by chaining stages.

In this particular implementation the interface consists of two parts:

- Pipeline
- Processor
- Stage

A pipeline consists of zero, one, or multiple stages. A Processor can process a payload against a pipeline. During the processing the payload will be passed to the first stage. From that moment on the resulting value is passed on from stage to stage.

In the simplest form, the execution chain can be represented as a foreach:

```
$result = $payload;

foreach ($stages as $stage) {
    $result = $stage($result);
}

return $result;
```

Effectively this is the same as:

```
$result = $stage3($stage2($stage1($payload)));
```

Immutability
------------

[](#immutability)

Pipelines are implemented as immutable stage chains. When you pipe a new stage, a new pipeline will be created with the added stage. This makes pipelines easy to reuse, and minimizes side-effects.

Usage
-----

[](#usage)

Operations in a pipeline, stages, can be anything that satisfies the `callable`type-hint, as well as Stage or Pipeline interfaces. So closures and anything that's invokable is okay.

```
$pipeline = (new Pipeline\Simple)->pipe(function ($payload) {
    return $payload * 10;
});
```

Class based stages.
-------------------

[](#class-based-stages)

Class based stages are also possible. The Stage can be implemented which ensures you have the correct method signature for the `process` method.

```
use SyberIsle\Pipeline\Pipeline;
use SyberIsle\Pipeline\Processor;
use SyberIsle\Pipeline\Stage;

class TimesTwoStage implements Stage
{
    public function process($payload)
    {
        return $payload * 2;
    }
}

class AddOneStage implements Stage
{
    public function process($payload)
    {
        return $payload + 1;
    }
}

$pipeline = (new Pipeline\Simple)
    ->pipe(new TimesTwoStage)
    ->pipe(new AddOneStage);

// Returns 21
(new Processor\FingersCrossed())->process($pipeline, 10);
```

Re-usable Pipelines
-------------------

[](#re-usable-pipelines)

Because the PipelineInterface is an extension of the StageInterface pipelines can be re-used as stages. This creates a highly composable model to create complex execution patterns while keeping the cognitive load low.

For example, if we'd want to compose a pipeline to process API calls, we'd create something along these lines:

```
$processApiRequest = (new Pipeline)
    ->pipe(new ExecuteHttpRequest) // 2
    ->pipe(new ParseJsonResponse); // 3

$pipeline = (new Pipeline)
    ->pipe(new ConvertToPsr7Request) // 1
    ->pipe($processApiRequest) // (2,3)
    ->pipe(new ConvertToResponseDto); // 4

(new Processor\FingersCrossed())->process($pipeline, new DeleteBlogPost($postId));
```

Pipeline Builders
-----------------

[](#pipeline-builders)

Because pipelines themselves are immutable, pipeline builders are introduced to facilitate distributed composition of a pipeline.

The pipeline builders collect stages and allow you to create a pipeline at any given time.

```
use SyberIsle\Pipeline\Pipeline\SimpleBuilder;

// Prepare the builder
$pipelineBuilder = (new SimpleBuilder)
    ->add(new LogicalStage)
    ->add(new AnotherStage)
    ->add(new LastStage);

// Build the pipeline
$pipeline = $pipelineBuilder->build();
```

Exception handling
------------------

[](#exception-handling)

This package is completely transparent when dealing with exceptions. In no case will this package catch an exception or silence an error. Exceptions should be dealt with on a per-case basis. Either inside a **stage** or at the time the pipeline processes a payload.

```
$pipeline = (new Pipeline)->pipe(function () {
    throw new LogicException();
});

try {
    (new Processor\FingersCrossed())->process($pipeline, $payload);
} catch(LogicException $e) {
    // Handle the exception.
}
```

Credits
-------

[](#credits)

- [Frank de Jonge](https://github.com/frankdejonge) for [League\\Pipeline](https://github.com/thephpleague/pipeline)
- [David Lundgren](https://github.com/dlundgren)
- [All Contributors](https://github.com/syberisle/pipeline/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

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

Every ~851 days

Total

2

Last Release

2082d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5eb9bc1606754fee81247bf5d4a6a4d7fb7cce1b3769de69a345c5c8e120211e?d=identicon)[dlundgren](/maintainers/dlundgren)

---

Top Contributors

[![dlundgren](https://avatars.githubusercontent.com/u/1322393?v=4)](https://github.com/dlundgren "dlundgren (16 commits)")

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[bomo/ical-bundle

Create ics url or file for Symfony 2, 3, 4 and 5

19291.4k](/packages/bomo-ical-bundle)[nystudio107/craft-routemap

Returns a list of Craft/Vue/React route rules and element URLs for ServiceWorkers from Craft entries

3151.6k2](/packages/nystudio107-craft-routemap)[open-southeners/laravel-companion-apps

Extend your Laravel applications with companions apps (Android, iOS, PWA...)

234.2k](/packages/open-southeners-laravel-companion-apps)[promethys/revive

A 'RecycleBin' page where users can restore or delete permanently soft-deleted models.

162.5k](/packages/promethys-revive)

PHPackages © 2026

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