Download the PHP package athari/yalinqo without Composer
On this page you can find all versions of the php package athari/yalinqo. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package yalinqo
YaLinqo: Yet Another LINQ to Objects for PHP
Features
- The most complete port of .NET LINQ to PHP, with many additional methods.
- Lazy evaluation, error messages and other behavior of original LINQ.
- Detailed PHPDoc and online reference based on PHPDoc for all methods. Articles are adapted from original LINQ documentation from MSDN.
- 100% unit test coverage.
- Best performance among full-featured LINQ ports (YaLinqo, Ginq, Pinq), at least 2x faster than the closest competitor, see performance tests.
- Callback functions can be specified as closures (like
function ($v) { return $v; }
), PHP "function pointers" (either strings like'strnatcmp'
or arrays likearray($object, 'methodName')
), string "lambdas" using various syntaxes ('"$k = $v"'
,'$v ==> $v+1'
,'($v, $k) ==> $v + $k'
,'($v, $k) ==> { return $v + $k; }'
). - Keys are as important as values. Most callback functions receive both values and the keys; transformations can be applied to both values and the keys; keys are never lost during transformations, if possible.
- SPL interfaces
Iterator
,IteratorAggregate
etc. are used throughout the code and can be used interchangeably with Enumerable. - Redundant collection classes are avoided, native PHP arrays are used everywhere.
- Composer support (package on Packagist).
- No external dependencies.
Implemented methods
Some methods had to be renamed, because their names are reserved keywords. Original methods names are given in parenthesis.
- Generation: cycle, emptyEnum (empty), from, generate, toInfinity, toNegativeInfinity, matches, returnEnum (return), range, rangeDown, rangeTo, repeat, split;
- Projection and filtering: cast, ofType, select, selectMany, where;
- Ordering: orderBy, orderByDescending, orderByDir, thenBy, thenByDescending, thenByDir;
- Joining and grouping: groupJoin, join, groupBy;
- Aggregation: aggregate, aggregateOrDefault, average, count, max, maxBy, min, minBy, sum;
- Set: all, any, append, concat, contains, distinct, except, intersect, prepend, union;
- Pagination: elementAt, elementAtOrDefault, first, firstOrDefault, firstOrFallback, last, lastOrDefault, lastOrFallback, single, singleOrDefault, singleOrFallback, indexOf, lastIndexOf, findIndex, findLastIndex, skip, skipWhile, take, takeWhile;
- Conversion: toArray, toArrayDeep, toList, toListDeep, toDictionary, toJSON, toLookup, toKeys, toValues, toObject, toString;
- Actions: call (do), each (forEach), write, writeLine.
In total, more than 80 methods.
Example
Process sample data:
Output (compacted):
Requirements
- Version 1 (stable): PHP 5.3 or higher.
- Version 2 (stable): PHP 5.5 or higher.
- Version 3 (pre-alpha): PHP 7.0 or higher.
Usage
Add to composer.json
:
Add to your PHP script:
License
Simplified BSD License
Copyright © 2012–2018, Alexander Prokhorov
All rights reserved.
Links
YaLinqo Articles
-
CodeProject (English):
- LINQ for PHP comparison: YaLinqo, Ginq, Pinq — performance comparison of full-featured LINQ ports, with some additional information.
-
Habrahabr (Russian):
- Comparison of old LINQ libraries — comparison of LINQ for PHP, Phinq, PHPLinq and Plinq, also Underscore.php.
- YaLinqo 1.0 with updated comparison — explanation of architecture and design decisions.
- YaLinqo 2.0 — switch to PHP 5.5 with generators support and related changes.
- LINQ for PHP: speed matters — performance comparison of full-featured LINQ ports (YaLinqo, Ginq, Pinq).
- Other (English):
- Tute Wall: How to use Linq in PHP by Mr. X — a series of posts covering basic usage of YaLinqo.
Related projects
- linq.js — LINQ for JavaScript. The one and only complete port of .NET LINQ to JavaScript.
- Underscore.js — library for functional programming in JavaScript. Similar to LINQ, but different method names and no lazy evaluation.
- Underscore.php — port of Underscore.js to PHP.
- RxPHP — reactive (push) counterpart of the active (pull) LINQ, port of Rx.NET.
- YaLinqoPerf — collection of performance tests comparing raw PHP, array functions, YaLinqo, YaLinqo with string lambdas, Ginq, Ginq with property accessors, Pinq.
All versions of yalinqo with dependencies
PHP Build Version
Package Version
Requires
php Version
>=5.5
The package athari/yalinqo contains the following files
Loading the files please wait ....