PHPackages                             marvin255/fluent-iterable - 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. marvin255/fluent-iterable

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

marvin255/fluent-iterable
=========================

Fluent interface for PHP iterable.

v0.14.1(1mo ago)19MITPHPPHP &gt;=8.3CI passing

Since Jul 13Pushed 1mo ago1 watchersCompare

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

READMEChangelog (10)Dependencies (12)Versions (25)Used By (0)

FluentIterable
==============

[](#fluentiterable)

[![Latest Stable Version](https://camo.githubusercontent.com/b9b5b15ce7ac386de5a542598f8c869513f81692aa4a729761cc65e865f6b35c/68747470733a2f2f706f7365722e707567782e6f72672f6d617276696e3235352f666c75656e742d6974657261626c652f76)](https://packagist.org/packages/marvin255/fluent-iterable)[![Total Downloads](https://camo.githubusercontent.com/76639cb665ae4e5afe65a77ad54fd52c10a682f93ddaf64fd1314d16ab2040c6/68747470733a2f2f706f7365722e707567782e6f72672f6d617276696e3235352f666c75656e742d6974657261626c652f646f776e6c6f616473)](https://packagist.org/packages/marvin255/fluent-iterable)[![License](https://camo.githubusercontent.com/b4b6ac4d90cad7d95790b49c80165f5e6b764c482c0fbce4954ddb1420d35038/68747470733a2f2f706f7365722e707567782e6f72672f6d617276696e3235352f666c75656e742d6974657261626c652f6c6963656e7365)](https://packagist.org/packages/marvin255/fluent-iterable)[![Build Status](https://github.com/marvin255/fluent-iterable/workflows/marvin255_fluent_iterable/badge.svg)](https://github.com/marvin255/fluent-iterable/actions?query=workflow%3A%22marvin255_fluent_iterable%22)

Object that provides `map`, `filter` and other array related functions for any iterable instances (`array`, `Iterator`, `Generator`) in a simple fluent style.

```
use Marvin255\FluentIterable\FluentIterable;
use Marvin255\FluentIterable\Helper\Reducer;
use Marvin255\FluentIterable\Helper\Filter;
use Marvin255\FluentIterable\Helper\Compare;

$input = [1, 2, 3, 4];
$result = FluentIterable::of($input)
    ->skip(1)
    ->filter(Filter::compare(Compare::LESS_THEN, 4))
    ->map(fn (int $item): int => $item + 1)
    ->reduce(Reducer::sum())
    ->get();
```

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

[](#installation)

Install via composer:

```
composer req marvin255/fluent-iterable
```

Usage
-----

[](#usage)

Initiate item using factory (any `iterable` instances are allowed)

```
$fluent = FluentIterable::of($input);
```

Apply intermediate methods (`merge`, `filter`, `map`, `skip`, `limit`, `sorted`, `peek`, `distinct`, `flatten`)

```
$fluent = $fluent->map(fn (int $item): int => $item + 1)
    ->filter(Filter::compare(Compare::LESS_THEN, 4))
    ->skip(1);
```

Get result using one of finalizing methods (`walk`, `reduce`, `findByIndex`, `findOne`, `findFirst`, `findLast`, `toArray`, `getIterator`, `count`, `matchAll`, `matchNone`, `matchAny`)

```
$result = $fluent->toArray();
```

Methods that convert list to a single item (`reduce`, `findOne`, `findByIndex`, `findFirst`, `findLast`) return an [`Optional`](https://github.com/marvin255/optional) instance.

Debugging
---------

[](#debugging)

`peek` method might be used to show intermediate data.

```
use Marvin255\FluentIterable\FluentIterable;
use Marvin255\FluentIterable\Helper\Reducer;
use Marvin255\FluentIterable\Helper\Filter;
use Marvin255\FluentIterable\Helper\Compare;

$input = [1, 2, 3, 4];
$result = FluentIterable::of($input)
    ->filter(Filter::compare(Compare::LESS_THEN, 3))
    ->peek(
        function (mixed $item): void {
            var_dump($item);
        }
    )
    ->reduce(Reducer::sum())
    ->get();
```

It will output something like

```
int(1)
int(2)

```

###  Health Score

45

—

FairBetter than 92% of packages

Maintenance93

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 93.2% 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 ~64 days

Recently: every ~166 days

Total

22

Last Release

36d ago

PHP version history (2 changes)v0.1.0PHP &gt;=8.1

v0.13.0PHP &gt;=8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/7c29b776ac327dcfcdfc20619a65826ad94a0cb554503386fb080299edfbe3e8?d=identicon)[marvin255](/maintainers/marvin255)

---

Top Contributors

[![marvin255](https://avatars.githubusercontent.com/u/2802915?v=4)](https://github.com/marvin255 "marvin255 (41 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")

---

Tags

iterableiteratorphpphparrayiteratorfluent-interface

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/marvin255-fluent-iterable/health.svg)

```
[![Health](https://phpackages.com/badges/marvin255-fluent-iterable/health.svg)](https://phpackages.com/packages/marvin255-fluent-iterable)
```

###  Alternatives

[ginq/ginq

LINQ to Object inspired DSL for PHP

192257.5k3](/packages/ginq-ginq)

PHPackages © 2026

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