PHPackages                             saintropeworks/php-linq - 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. saintropeworks/php-linq

ActiveLibrary

saintropeworks/php-linq
=======================

A PHP implementation of LINQ-style enumerable operations.

2026.08.24.7(yesterday)06↑2900%MITPHPPHP &gt;=8.5CI passing

Since Aug 24Pushed yesterdayCompare

[ Source](https://github.com/SaintRopeWorks/PHP_LINQ)[ Packagist](https://packagist.org/packages/saintropeworks/php-linq)[ RSS](/packages/saintropeworks-php-linq/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (8)Used By (0)

PHP LINQ
========

[](#php-linq)

A modern PHP implementation of Microsoft's LINQ (Language Integrated Query), designed specifically for **PHP 8.5+** and optimized for composable, pipeline-based query construction.

PHP LINQ is intended to provide a familiar LINQ programming model to PHP developers while taking advantage of modern PHP language features rather than attempting to maintain compatibility with legacy PHP versions.

Requirements
------------

[](#requirements)

- PHP 8.5 or later
- Composer

PHP LINQ is intentionally **not** designed for backwards compatibility with older PHP versions. The library targets modern PHP and makes use of language features available in PHP 8.5+, including the pipeline operator (`|>`).

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

[](#installation)

Install PHP LINQ through Composer:

```
composer require saintropeworks/php-linq
```

Example
-------

[](#example)

```
use function SRW\LINQ\{
    Where,
    Select,
    Average
};

$averageAge = $users
    |> Where(fn($user) => $user->isActive)
    |> Select(fn($user) => $user->age)
    |> Average();
```

### LINQ Functions

[](#linq-functions)

LINQ functions are imported using PHP's `use function` syntax, allowing you to pull in only the operations you want to use:

```
use function SRW\LINQ\{
    Where,
    Select,
    Average
};
```

The goal is to provide the full C# LINQ operation set in PHP. Where PHP's lack of method overloading makes a direct one-to-one translation impossible, separate function names are used to represent the different overloads.

For example:

- `Where` — The standard `Func` predicate.
- `WhereWithIndex` — The overload using `Func`.

This same approach is used throughout the library where necessary to preserve the functionality of the corresponding LINQ overloads.

### How It Works

[](#how-it-works)

All of the functions exposed through `SRW\LINQ` are essentially partial-function wrappers around the corresponding functions provided by `Enumerable`.

There is nothing stopping you from using `Enumerable` directly:

```
use SRW\LINQ\Enumerable;

$filteredUsers = Enumerable::Where(
    $users,
    fn($user) => $user->isActive
);

$selectedUsers = Enumerable::Select(
    $filteredUsers,
    fn($user) => $user->age
);

$averageAge = Enumerable::Average($selectedUsers);
```

However, the point of the function wrappers is to get as close as PHP can reasonably get to the fluent, extension-method style of C# LINQ.

Combined with PHP's pipeline operator (`|>`), the result is a composable LINQ-style query syntax:

```
$averageAge = $users
    |> Where(fn($user) => $user->isActive)
    |> Select(fn($user) => $user->age)
    |> Average();
```

The goal is simple: **make LINQ feel like LINQ, while working with PHP rather than fighting against it.**

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance100

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 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 ~0 days

Total

7

Last Release

1d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/28634997?v=4)[TofuBug](/maintainers/TofuBug)[@TofuBug](https://github.com/TofuBug)

---

Top Contributors

[![TofuBug](https://avatars.githubusercontent.com/u/28634997?v=4)](https://github.com/TofuBug "TofuBug (7 commits)")

### Embed Badge

![Health badge](/badges/saintropeworks-php-linq/health.svg)

```
[![Health](https://phpackages.com/badges/saintropeworks-php-linq/health.svg)](https://phpackages.com/packages/saintropeworks-php-linq)
```

PHPackages © 2026

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