PHPackages                             pitchart/transformer - 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. pitchart/transformer

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

pitchart/transformer
====================

A transducers implementation in PHP, with OOP powers

v1.6.2(6y ago)1016.8k1[3 issues](https://github.com/pitchart/transformer/issues)MITPHPPHP &gt;=7.0CI failing

Since Feb 18Pushed 5y ago1 watchersCompare

[ Source](https://github.com/pitchart/transformer)[ Packagist](https://packagist.org/packages/pitchart/transformer)[ RSS](/packages/pitchart-transformer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (22)Used By (0)

Transformer
===========

[](#transformer)

A transducers implementation in PHP, with OOP powers

This package has been inspired by libraries provided by other languages, like clojure's transducers or JAVA Stream API.

Why ?
-----

[](#why-)

> Transducers are composable algorithmic transformations. They are independent from the context of their input and output sources and specify only the essence of the transformation in terms of an individual element. Because transducers are decoupled from input or output sources, they can be used in many different processes - collections, streams, channels, observables, etc. Transducers compose directly, without awareness of input or creation of intermediate aggregates.

[More information on the clojure reference](https://clojure.org/reference/transducers)

With classical pipeline pattern, the whole collection is iterated for each step of the transformation and creates an intermediate collection which is a massive waste in memory usage.

Transducers use functional composition to reduce the number of iterations made while applying transformation.

Installation
------------

[](#installation)

```
composer require pitchart/transformer
```

Usage
-----

[](#usage)

A transformation consists in a pipeline of transformation functions, called Reducers, ended by a reducing function, aka Termination.

```
use function Pitchart\transform;

transform([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0])
    ->filter(function (int $integer) { return $integer % 2 === 0;})    // [0, 2, 4, 6, 8, 8, 6, 4, 2, 0]
    ->map(function (int $integer) { return $integer + 1; })    // [1, 3, 5, 7, 9, 9, 7, 5, 3, 1]
    ->dedupe()    // [1, 3, 5, 7, 9, 9, 7, 5, 3, 1]
    ->distinct()    // [1, 3, 5, 7, 9]
    ->take(3)     // [1, 3, 5]
    ->sum()    // 9
;
```

API documentation
-----------------

[](#api-documentation)

"Functional patterns" used by the library are discribed in the [Reducers documentation](docs/Reducers.md)

Credits
-------

[](#credits)

- [Julien VITTE](https://github.com/pitchart)
- [All contributors](https://github.com/pitchart/transformer/graphs/contributors)

Licence
-------

[](#licence)

The MIT License (MIT). See [License file](LICENCE.md) for more information.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance14

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 98.3% 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 ~63 days

Recently: every ~16 days

Total

14

Last Release

2193d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3d434eb5aaedc60d5fb046facaf6445f1f1e52260d6776e3af30f1a7541d6385?d=identicon)[pitchart](/maintainers/pitchart)

---

Top Contributors

[![pitchart](https://avatars.githubusercontent.com/u/2943883?v=4)](https://github.com/pitchart "pitchart (118 commits)")[![Athanor-ig](https://avatars.githubusercontent.com/u/247112183?v=4)](https://github.com/Athanor-ig "Athanor-ig (2 commits)")

---

Tags

collectioncompositionfunctional-programmingiterablesphptransducercollectioniterablefunctional-programmingcompositiontransducer

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/pitchart-transformer/health.svg)

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

###  Alternatives

[phpcollection/phpcollection

General-Purpose Collection Library for PHP

1.0k64.0M34](/packages/phpcollection-phpcollection)[league/pipeline

A plug and play pipeline implementation.

1.0k16.0M74](/packages/league-pipeline)[league/period

Time range API for PHP

7335.4M21](/packages/league-period)[loophp/collection

A (memory) friendly, easy, lazy and modular collection class.

745663.8k13](/packages/loophp-collection)[lorisleiva/lody

Load files and classes as lazy collections in Laravel.

956.6M9](/packages/lorisleiva-lody)[pragmarx/coollection

Laravel Illuminate collection with objectified properties

943.4M11](/packages/pragmarx-coollection)

PHPackages © 2026

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