PHPackages                             gbenm/phipes - 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. gbenm/phipes

ActiveLibrary

gbenm/phipes
============

A simple library for transforming iterables

00PHP

Since Feb 4Pushed 2y ago1 watchersCompare

[ Source](https://github.com/gbenm/phipes)[ Packagist](https://packagist.org/packages/gbenm/phipes)[ RSS](/packages/gbenm-phipes/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Phipes
======

[](#phipes)

Allows chaining transformations of iterables or building reusable pipelines, while also being easily extensible.

Quickstart
----------

[](#quickstart)

### Some ways to transform an iterable

[](#some-ways-to-transform-an-iterable)

```
// (temporal results) iterate many times over the same iterable
$result = array_filter($someIterable, $isOdd);
$result = array_map($mulByThree, $result);
$result = array_map($addTwo, $result);

// iterate many times over the same iterable
$result = array_map($addTwo, array_map($mulByThree, array_filter($someIterable, $isOdd)));

// imperative way
$result = [];
foreach ($someIterable as $item) {
    if ($isOdd($item)) {
        $result[] = $addTwo($mulByThree($item));
    }
}
```

### Using Phipes

[](#using-phipes)

Iterate only once

```
use Phipes\Pipeline;

// delay computation
$result = Pipeline::for($someIterable)
    ->filter($isOdd)
    ->map($mulByThree)
    ->map($addTwo)
    ->asIterable(); // lazy

$result = Pipeline::for($someIterable)
    ->filter($isOdd)
    ->map($mulByThree)
    ->map($addTwo)
    ->asArray(); // start computing at this point

// Creating a pipeline

$pipeline = Pipeline::builder()
    ->filter($isOdd)
    ->map($mulByThree)
    ->map($addTwo)
    ->build();

$results = $pipeline($someIterable);

$otherResults = $pipeline($someIterable2);
```

Create a new transformer
------------------------

[](#create-a-new-transformer)

```
// by example the map function
/** @param (callable($value, [$key]): mixed) $fn  */
function map(callable $fn): callable
{
    return function (iterable $iterable) use ($fn): iterable {
        foreach ($iterable as $key => $item) {
            yield $key => call_user_func($fn, $item, $key);
        }
    };
}

// now you can use the pipe method or call the result
$result = Pipeline::for($someIterable)
    ->pipe(map(fn ($v) => $v + 1))
    ->asIterable(); // lazy

// alternative
$result = Pipeline::for($someIterable)
    (map(fn ($v) => $v + 1))
    ->asIterable(); // lazy
```

###  Health Score

12

—

LowBetter than 0% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity19

Early-stage or recently created project

 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.

### Community

Maintainers

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

---

Top Contributors

[![gbenm](https://avatars.githubusercontent.com/u/75090088?v=4)](https://github.com/gbenm "gbenm (10 commits)")

### Embed Badge

![Health badge](/badges/gbenm-phipes/health.svg)

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

PHPackages © 2026

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