https://github.com/TimeToogo/Pinq
PHP Integrated Query, a real LINQ library for PHP
https://github.com/TimeToogo/Pinq
Last synced: about 2 months ago
JSON representation
PHP Integrated Query, a real LINQ library for PHP
- Host: GitHub
- URL: https://github.com/TimeToogo/Pinq
- Owner: TimeToogo
- License: mit
- Archived: true
- Created: 2014-03-29T00:30:11.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2022-05-03T14:53:29.000Z (about 3 years ago)
- Last Synced: 2025-03-11T11:53:23.931Z (3 months ago)
- Language: PHP
- Homepage: http://timetoogo.github.io/Pinq/
- Size: 3.73 MB
- Stars: 462
- Watchers: 27
- Forks: 19
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-php - PINQ - A PHP library based on .NET's LINQ (Language Integrated Query). (Table of Contents / Data Structure and Storage)
- awesome-php-cn - PINQ - 一个基于PHP库.NET's LINQ (Language Integrated Query). (目录 / 数据结构和存储 Data Structure and Storage)
- awesome-projects - PINQ - A PHP library based on .NET's LINQ (Language Integrated Query). (PHP / Data Structure and Storage)
- awesome-php - PINQ - A PHP library based on .NET's LINQ (Language Integrated Query). (Table of Contents / Data Structure and Storage)
README
PHP Integrated Query - [Official site](http://timetoogo.github.io/Pinq/)
========================================================================[](https://travis-ci.org/TimeToogo/Pinq)
[](https://scrutinizer-ci.com/g/TimeToogo/Pinq)
[](https://coveralls.io/r/TimeToogo/Pinq?branch=master)
[](https://packagist.org/packages/timetoogo/pinq)
[](https://packagist.org/packages/timetoogo/pinq)What is PINQ?
=============Based off the .NET's [LINQ (Language integrated query)](http://msdn.microsoft.com/en-us/library/bb397926.aspx),
PINQ unifies querying across [arrays/iterators](http://timetoogo.github.io/Pinq/examples.html) and [external data sources](http://timetoogo.github.io/Pinq/query-provider.html),
in a single readable and concise [fluent API](http://timetoogo.github.io/Pinq/api.html).An example
==========```php
$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'],
];
});
```[More examples](http://timetoogo.github.io/Pinq/examples.html)
Installation
============PINQ is compatible with >= PHP 7.3
Install the package via composer:
```
composer require timetoogo/pinq
```