PHPackages                             pyther/linquo - 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. pyther/linquo

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

pyther/linquo
=============

Sequence with Linq like support for PHP

v0.1.0(11mo ago)01PHP

Since May 31Pushed 11mo agoCompare

[ Source](https://github.com/peterGdot/Pyther.Linquo)[ Packagist](https://packagist.org/packages/pyther/linquo)[ RSS](/packages/pyther-linquo/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Linquo
======

[](#linquo)

*Linquo* is a lightweight PHP library to support LINQ-like operations on sequences such as arrays with the following features:

- support all .Net LINQ methods up to .Net 10
- brings additional methods (like `toJson`)
- based on Lazy Evaluation
- fast execution
- support for Comparer like `StringComparer::$OrdinalIgnoreCase`
- no external dependencies

let's start with a simple example:

```
$people = [array of peoples];

// give me all adults names in alphabetical order as an array
$names = from($people)
    ->where(fn($e) => $e->age >= 18)   // only persons of 18 or older
    ->orderBy(fn($e) => $e->name)      // order by name
    ->select(fn($e) => $e->name)       // select the name only
    ->toArray();                       // convert to array
```

and a more complex one:

```
echo $books
    ->where(fn($e) => $e->year > 1850)  // all books after 1850
    ->orderBy(fn($e) => $e->year)       // sort by year
    ->join(                             // join with ...
        $authors,                       // ... authors ...
        fn($book) => $book->authorId,   // ... where the books author id ...
        fn($author) => $author->id,     // ... matches the authors id.
        fn($book, $author) => "{$book->title} by {$author->name} in {$book->year}"
    )->toJson();                        // and return as json
```

results to:

```
[
    "Men and Women by Robert Browning in 1855",
    "Great Expectations by Charles Dickens in 1861",
    "The Ring and the Book by Robert Browning in 1868",
    "War and Peace by Leo Tolstoy in 1869",
    "The Adventures of Tom Sawyer by Mark Twain in 1876",
    "Adventures of Huckleberry Finn by Mark Twain in 1884"
]
```

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

[](#installation)

Install as [Composer](https://packagist.org/packages/pyther/linquo) Package:

`composer require pyther/linquo`

Supported LINQ methods
----------------------

[](#supported-linq-methods)

List of supported LINQ methods, ordered by name:

MethodDescription`aggregate`Aggregate the elements of a sequence into a single value.`aggregateBy`Aggregate the elements of a sequence into a grouped result.`all`Check if all elements in the sequence satisfy a given predicate.`any`Check if any element in the sequence satisfies a given predicate.`append`Append a value to the current sequence.`average`Calculate the average of the elements in the sequence.`case`Cast the elements of the sequence to a specified type or apply a function to each element.`chunk`Chunk the sequence into smaller sequences of a specified size.`concat`Concatenate the elements of another sequence, array, traversable or iterable to the end of the sequence.`contains`Check if the sequence contains a specific value.`count`Count the number of elements in the sequence.`countBy`Count the number of elements in the sequence based on a key selector.`distinct`Create a distinct sequence by removing duplicate elements.`distinctBy`Create a distinct sequence by removing duplicate elements based on a key selector.`elementAt`Get the element at a specified index in the sequence.`elementAtOrNull`Get the element at a specified index in the sequence or null if it doesn't exist.`empty`Create an empty Sequence.`except`Create a new sequence by applying the set difference of two sequences.`exceptBy`Create a new sequence by applying the set difference of two sequences based on a key selector.`first`Get the first element of the sequence or the first element that satisfies a predicate.`firstOrNull`Get the first element of the sequence or null if no element satisfies a predicate.`groupBy`Group the elements of the sequence by a specified key selector.`groupJoin`Join the elements of two sequences based on key equality, and groups the results.`index`Return a sequence of elements with their indices.`intersect`Get the intersection of two sequences, returning elements that are present in both.`intersectBy`Get the intersection of two sequences based on a key selector, returning elements that are present in both.`join`Join two sequences based on key equality into a new sequence.`last`Get the last element of the sequence or the last element that satisfies a predicate.`lastOrNull`Get the last element of the sequence or null if no element satisfies a predicate.`leftJoin`Left join two sequences based on key equality into a new sequence.`max`Get the maximum value in the sequence or the maximum value based on a function.`maxBy`Get the maximum value in the sequence based on a function and an optional comparer.`min`Get the minimum value in the sequence or the minimum value based on a function.`minBy`Get the minimum value in the sequence based on a function and an optional comparer.`ofType`Filter the elements of the sequence based on their type.`order`Order the elements of the sequence based on a comparer or default comparison.`orderBy`Order the elements of the sequence based on a key selector and an optional comparer.`orderByDescending`Order the elements of the sequence in descending order based on a key selector.`orderDescending`Order the elements of the sequence in descending order based on a comparer or default comparison.`prepend`Prepend a value or a sequence to the current sequence.`range`Create a Sequence from a range of integers.`repeat`Create a Sequence that repeats a value a specified number of times.`reverse`Create a new sequence in reverse order.`rightJoin`Right join two sequences based on key equality into a new sequence.`select`Select elements from the sequence based on a selector function.`selectMany`Select elements from the sequence and flatten the results into a single sequence.`sequenceEqual`Check if two sequences are equal based on their elements and an optional comparer.`shuffle`Shuffle the elements of the sequence randomly.`single`Get the the element that satisfies the predicate or throw an exception if more than one element is found.`singleOrNull`Get a single element from the sequence or null if no element is found.`skip`Skip a specified number of elements in the sequence.`skipLast`Skip the last specified number of elements in the sequence.`skipWhile`Skip elements in the sequence while a predicate is true.`sum`Get the sum of the elements in the sequence or the sum based on a selector function.`take`Take a specified number of elements from the sequence.`takeLast`Take the last specified number of elements from the sequence.`takeWhile`Take elements from the sequence while a predicate is true.`thenBy`Order an already ordered sequence in ascending order.`thenByDescending`Order an already ordered sequence in descending order.`toArray`Convert the sequence to an array.`toDictionary`Convert the sequence to a dictionary (associative array)`toHashSet`Convert the sequence to a hash set (array with unique values).`toList`Convert the sequence to a doubly linked list.`toLookup`Convert the sequence to a lookup (associative array with multiple values for each key).`tryGetNonEnumeratedCount`Try to get the count of elements in the sequence without enumerating it.`union`Get the union of two sequences, returning elements that are present in either sequence.`unionBy`Get the union of two sequences based on a key selector, returning elements that are present in either sequence.`where`Filter the elements of the sequence based on a predicate.`zip`Zip two sequences together, combining elements from both sequences into a new sequence.Additional methods
------------------

[](#additional-methods)

List of additional methods, ordered by name:

MethodDescription`toJson`Convert the sequence to a JSON string.Supported interfaces
--------------------

[](#supported-interfaces)

All sequences support methods and behaviour of the following interfaces:

MethodDescription`IteratorAggregate``Countable`ToDo
----

[](#todo)

- complete inline docs
- create documentation with samples
- optimize all SET operations using hashs and multidimensional lookups

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance50

Moderate activity, may be stable

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity26

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

353d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/904a2f429f6b7e47ef87a331a8266be72a7e15970c2e0e28f8a257c2efbcb711?d=identicon)[peterGdot](/maintainers/peterGdot)

---

Top Contributors

[![peterGdot](https://avatars.githubusercontent.com/u/124894114?v=4)](https://github.com/peterGdot "peterGdot (1 commits)")

---

Tags

leightweightlinqphpphplinqsequenceslinquo

### Embed Badge

![Health badge](/badges/pyther-linquo/health.svg)

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

###  Alternatives

[imanghafoori/laravel-anypass

A minimal yet powerful package to help you in development.

21421.6k](/packages/imanghafoori-laravel-anypass)

PHPackages © 2026

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