PINQ

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

  • 所有者: TimeToogo/Pinq
  • 平台: Linux, Mac, Windows
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

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

主要指標

概覽
名稱與所有者TimeToogo/Pinq
主編程語言PHP
編程語言PHP (語言數: 1)
平台Linux, Mac, Windows
許可證MIT License
所有者活动
創建於2014-03-29 00:30:11
推送於2022-05-03 14:53:29
最后一次提交2022-05-04 00:53:28
發布數15
最新版本名稱3.5.0 (發布於 )
第一版名稱1.0.0 (發布於 )
用户参与
星數461
關注者數27
派生數19
提交數476
已啟用問題?
問題數20
打開的問題數2
拉請求數6
打開的拉請求數1
關閉的拉請求數1
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?

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