timetoogo / pinq
PHP Integrated Query - A real LINQ library for PHP
Installs: 91 797
Dependents: 4
Suggesters: 0
Security: 0
Stars: 465
Watchers: 27
Forks: 17
Open Issues: 3
Requires
- php: >=7.3.0
- nikic/php-parser: ~4.10
Requires (Dev)
- doctrine/cache: 1.5.*
- phpunit/phpunit: ^9.0
- satooshi/php-coveralls: 1.0.*
README
What is PINQ?
Based off the .NET's LINQ (Language integrated query), PINQ unifies querying across arrays/iterators and external data sources, in a single readable and concise fluent API.
An example
$youngPeopleDetails = $people ->where(function ($row) { return $row['age'] <= 50; }) ->orderByAscending(function ($row) { return $row['firstName']; }) ->thenByAscending(function ($row) { return $row['lastName']; }) ->take(50) ->indexBy(function ($row) { return $row['phoneNumber']; }) ->select(function ($row) { return [ 'fullName' => $row['firstName'] . ' ' . $row['lastName'], 'address' => $row['address'], 'dateOfBirth' => $row['dateOfBirth'], ]; });
Installation
PINQ is compatible with >= PHP 7.3
Install the package via composer:
composer require timetoogo/pinq