PHPackages                             qmaker/linq\_php - 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. qmaker/linq\_php

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

qmaker/linq\_php
================

LINQ from C# to php

1.0.x-dev(12y ago)1192[1 issues](https://github.com/morgen2009/linq_php/issues)PHP

Since Feb 4Pushed 12y ago4 watchersCompare

[ Source](https://github.com/morgen2009/linq_php)[ Packagist](https://packagist.org/packages/qmaker/linq_php)[ RSS](/packages/qmaker-linq-php/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

Linq in PHP
===========

[](#linq-in-php)

This is PHP library, that allows to query collections following C# LINQ patterns. The standard LINQ methods are implemented with interfaces adopted to the PHP language. The full list of these methods can be taken from [MSDN, .NET 4.5](http://msdn.microsoft.com/en-us/library/vstudio/system.linq.enumerable_methods). The modified interfaces of these methods are located in the [Qmaker\\Linq\\Operation](Qmaker/Linq/Operation) namespace. At the present time the library requires PHP of the version 5.4.

Lambda expression
-----------------

[](#lambda-expression)

The class *Lambda* allows to build lambda expressions, anonymous functions with stored structure. The class creates a callable object, which can be used in LINQ methods as callable criteria, predicate or expression. Thus,

```
$f = Lambda::define()->x()->add()->v()->mult(12)->gt(36);

```

or

```
$f = Lambda::define('x+x*12>36');

```

are equivalent to

```
$f = function ($x) { return $x + $x*12 > 36; };

```

but include also information about the expression structure.

More information and examples will be added later. See [unit tests](tests/Qmaker/Linq).

Linq
----

[](#linq)

The following methods are implemented

- Aggregation — aggregate, average, min, max, sum, count
- Concatenation — concat, zip
- Element — elementAt, elementAtOrDefault, first, firstOrDefault, last, lastOrDefault, single, singleOrDefault
- Equality — isEqual
- Filtering — ofType, where
- Generation — from, range, repeat, empty\_, defaultIfEmpty
- Grouping — groupBy
- Joining — product, join, joinOuter, groupJoin
- Partitioning — skip, skipWhile, take, takeWhile
- Projection — select, selectMany, cast
- Quantifier — all, any, contains
- Set — distinct, intersect, except, union
- Sorting — orderBy, orderByDescending, thenBy, thenByDescending, reverse, order
- Others — toArray, toList, asEnumerable, toLookup, toDictionary, each

The suited types for the source in the corresponding methods (like *from* or *join*) are **array**, **\\Iterator**, **\\IteratorAggregate** or **callable** variable. As an expression parameter one can also specify **string**, **callable** variable, **array** or lambda expression. The following example

```
$f = Linq::from([1, 2, 3, 4])->where((new Lambda())->x()->gt(2))->sum((new Lambda())->x()->mult(2));

```

will return 14. More information and examples will be added later. See [unit tests](tests/Qmaker/Linq).

Iterators
---------

[](#iterators)

The iterators are the keystone of this library. Within the project multiple iterators were additionally implemented

- **CallbackFilterIterator** Filtering items using multiple callbacks
- **CallbackIterator** Generate the sequence of the elements using a callback
- **GroupingIterator** Group elements by key
- **IndexIterator** Sort elements by key
- **JoinIterator**, **OuterJoinIterator** Inner/outer join of two iterators
- **LimitIterator** Iterator over the given range
- **ProductIterator** Cross-product of multiple iterators
- **SkipIterator** Skip items while some criteria is true
- **TakeIterator** Take items while some criteria is true
- **ProjectionIterator** Convert current values or keys
- **ReverseIterator** Reverse order
- **DistinctIterator**, **ExceptIterator**, **IntersectIterator** Sets operations
- **LazyIterator** Build inner iterator when the first item will be requested
- **VariableIterator** Re-assign the inner iterator

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity49

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

Unknown

Total

1

Last Release

4529d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1876842?v=4)[Vladimir Schmidt](/maintainers/morgen2009)[@morgen2009](https://github.com/morgen2009)

---

Top Contributors

[![morgen2009](https://avatars.githubusercontent.com/u/1876842?v=4)](https://github.com/morgen2009 "morgen2009 (70 commits)")

### Embed Badge

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

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

###  Alternatives

[ec-europa/toolkit

Toolkit packaged for Drupal projects based on Robo.

39250.0k28](/packages/ec-europa-toolkit)

PHPackages © 2026

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