PHPackages                             sanmai/lazy-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. sanmai/lazy-linq

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

sanmai/lazy-linq
================

.NET LINQ-like library with mandatory lazy evaluation

v0.6(6y ago)2121[10 issues](https://github.com/sanmai/LazyLINQ/issues)[1 PRs](https://github.com/sanmai/LazyLINQ/pulls)Apache-2.0PHPPHP ^7.0

Since Mar 14Pushed 5y ago1 watchersCompare

[ Source](https://github.com/sanmai/LazyLINQ)[ Packagist](https://packagist.org/packages/sanmai/lazy-linq)[ RSS](/packages/sanmai-lazy-linq/feed)WikiDiscussions master Synced yesterday

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

[![Build Status](https://camo.githubusercontent.com/53cb09fb1a895c7343dfe0bf932521546edbde2764f0877ea81e58d97e5b63bb/68747470733a2f2f7472617669732d63692e6f72672f73616e6d61692f4c617a794c494e512e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/sanmai/LazyLINQ)[![Coverage Status](https://camo.githubusercontent.com/16d552ce1899a8b677f2894f67d002bde9759c6666fb93dfc5091f99daaf3a3a/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f73616e6d61692f4c617a794c494e512f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/sanmai/LazyLINQ?branch=master)[![Infection MSI](https://camo.githubusercontent.com/a614d3f58090dc0ef176c1b35a3add2f23671a2849e25038b350037d08c63aeb/68747470733a2f2f62616467652e737472796b65722d6d757461746f722e696f2f6769746875622e636f6d2f73616e6d61692f4c617a794c494e512f6d75746174696f6e2d6261646765)](https://infection.github.io)[![Codacy Badge](https://camo.githubusercontent.com/528a13d1b97d153a1a0241015e1138358913c6727e0602ecfeef639a6010600c/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3338353764363863316163623465356538316462373034396237383439343061)](https://www.codacy.com/app/sanmai/LazyLINQ)[![Maintainability](https://camo.githubusercontent.com/b2a5dd83e2e1b6f997dec22d9930f3cd59745fe583742b8567f2dc0054e9f63a/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f35313964326430383334613865323534613662662f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/sanmai/LazyLINQ/maintainability)

This library implements most of [the API methods](https://msdn.microsoft.com/en-us/library/system.linq.enumerable.aspx) from .NET static class `System.Linq.Enumerable` which do not require having the whole data set in memory. If you're used to LINQ query operations from .NET, you should feel like home.

Powered by generators, this library works in a lazy way: instead of doing computing on the whole sequence at once, it would only do necessary computing while you're iterating through the sequence.

Install
=======

[](#install)

```
composer require sanmai/lazy-linq

```

API Compatibility
=================

[](#api-compatibility)

MethodDetails✔️Aggregate()✔️All()✔️Any()✔️Append()Returns a new collection.AsEnumerable()Not applicable to PHP.✔️Average()✔️Cast()✔️Concat()✔️Contains()✔️Count()DefaultIfEmpty()Not applicable.✔️Distinct()Only removes repeated elements, think `uniq`.✔️ElementAt()`@throws` 💣✔️ElementAtOrDefault()Always a null default value, `@throws` 💣✔️Empty()Returns a new empty collection.✔️Except()Returns a new collection.✔️First()FirstOrDefault()Collections are not typed in PHP.GroupBy()Needs all data at once.GroupJoin()Intersect()Join()✔️Last()LastOrDefault()Not applicable.LongCount()No separate `long` type in PHP.✔️Max()✔️Min()✔️OfType()There's also `ofClass()` for classes.OrderBy()Needs to have the whole set of data in memory to function.OrderByDescending()✔️Prepend()Returns a new collection.✔️Range()Semantically different from standard `range()` function.✔️Repeat()Reverse()Needs all data at once.✔️Select()✔️SelectMany()SequenceEqual()✔️Single()`@throws` 💣SingleOrDefault()✔️Skip()✔️SkipWhile()✔️Sum()✔️Take()Returns a new collection.✔️TakeWhile()Returns a new collection.ThenBy()Sorting needs all data at once.ThenByDescending()Sorting needs all data at once.✔️ToArray()ToDictionary()Not applicable.ToList()Not applicable.ToLookup()Not applicable.Union()Needs to store all previously processed data.✔️Where()✔️Zip()Returns a new collection.Only non-lazy (or eager) methods are left out as they can't have a correct lazy implementation with generators. Sure, they could be implemented as standard deferred methods, but still, they'll want all the data at once.

For all inputs, keys are not exported nor used. If you absolutely need to access keys, consider storing them with the data.

Durability
==========

[](#durability)

This library is built to last. Whatever you throw at it, it should just work.

There are only few methods marked with a 💣 above that may throw an exception: .NET API requires that, so it was unavoidable. Other than that, you can expect only standard language errors to happen.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.8% 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 ~85 days

Recently: every ~141 days

Total

9

Last Release

2294d ago

PHP version history (2 changes)v0.1PHP &gt;=7

v0.3-betaPHP ^7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/edcb8dde95c71b1c97c3c91e57d3548795fa2014c657744fb878e2be3b5949fc?d=identicon)[sanmai](/maintainers/sanmai)

---

Top Contributors

[![sanmai](https://avatars.githubusercontent.com/u/139488?v=4)](https://github.com/sanmai "sanmai (161 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (1 commits)")[![stickler-ci](https://avatars.githubusercontent.com/u/16011037?v=4)](https://github.com/stickler-ci "stickler-ci (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/sanmai-lazy-linq/health.svg)

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

###  Alternatives

[markbaker/enumhelper

A small library that provides Helper Traits for PHP 8.1 Enums

2819.4k1](/packages/markbaker-enumhelper)[thunderer/numbase

Convert any number between arbitrary bases

242.3k](/packages/thunderer-numbase)[asgardcms/block

A module to create small blocks of content to display anywhere on the site.

126.0k](/packages/asgardcms-block)

PHPackages © 2026

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