PINQ

PHP集成查询,PHP的一个真正的LINQ库。(PHP Integrated Query, a real LINQ library for PHP.)

  • Owner: TimeToogo/Pinq
  • Platform: Linux, Mac, Windows
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

PHP Integrated Query

PINQ 是什么?

基于 .NET 的 LINQ(语言集成查询),PINQ 将跨数组/迭代器和外部数据源的查询统一为一个可读且简洁流畅的 API。

一个例子

以下显示使用 PINQ 库的示例查询:

$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'],
            ]; 
        });

PINQ 的优点如下,上述查询可能针对一组数组或可能针对数据库表执行。 PINQ 使用 PHP 开发人员可用的最强大和最自然的语言来模糊内存和外部数据源之间的界限。

更多例子

安装

PINQ 兼容 >= PHP 5.5

通过composer安装包:

composer require timetoogo/pinq

Overview

Name With OwnerTimeToogo/Pinq
Primary LanguagePHP
Program languagePHP (Language Count: 1)
PlatformLinux, Mac, Windows
License:MIT License
Release Count15
Last Release Name3.5.0 (Posted on )
First Release Name1.0.0 (Posted on )
Created At2014-03-29 00:30:11
Pushed At2022-05-03 14:53:29
Last Commit At2022-05-04 00:53:28
Stargazers Count458
Watchers Count28
Fork Count17
Commits Count476
Has Issues Enabled
Issues Count20
Issue Open Count2
Pull Requests Count6
Pull Requests Open Count1
Pull Requests Close Count1
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private

PHP Integrated Query - Official site

Build status
Code quality
Coverage Status
Stable Release
License

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'],
            ]; 
        });

More examples

Installation

PINQ is compatible with >= PHP 5.5

Install the package via composer:

composer require timetoogo/pinq
To the top