ultimate-guitar/yii2-pq
Composer 安装命令:
composer require ultimate-guitar/yii2-pq
包简介
A paged query class for Yii2 to deal with PHP7 changed in mysqlnd
关键字:
README 文档
README
A paged query class for Yii2 to deal with PHP7 changes in mysqlnd
It will load your result set the same way as pagination works using OFFSET and LIMIT.
This extension is 99% for MySQL users.
Installation
Just include it in your composer:
php composer require "sammaye/yii2-pq":"~1.0.0"
Usage
$query = (new \sammaye\pq\Query)
->from(Title::tableName())
->where('live=1')
->limit(300)
->orderBy(['id' => SORT_DESC]);
foreach($query->each() as $k => $v){
And it will return in batches of 100 up to 300.
As you can see there is not much to learn about this extension except how to include it.
Note: There is no active record part to this query currently due to the
nature of PHP class inheritance and inclusion which means I would have to copy the ActiveQuery entirely.
Why?
I noticed that many of my cronjobs failed after an upgrade to PHP7. It was not long before I realised that there were two changes since PHP5.4:
- The default MySQL driver used by PHP7 has changed to mysqlnd
- And, mysqlnd now adds your result sets to it's own memory, buffering queries
Added to that, my own observations that unbuffered queries suck meant that I created this.
ultimate-guitar/yii2-pq 适用场景与选型建议
ultimate-guitar/yii2-pq 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 190.73k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 06 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「db」 「pagination」 「query」 「yii2」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ultimate-guitar/yii2-pq 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ultimate-guitar/yii2-pq 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ultimate-guitar/yii2-pq 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A custom URL rule class for Yii 2 which allows to create translated URL rules
Query filtering in your frontend
Anax Database Active Record module for model classes.
Database/ORM-agnostic query construction helper
Provides a Data Grid tables for your Symfony project.
SCEditor, a lightweight WYSIWYG BBCode & HTML editor extension for Yii 2.0 Framework
统计信息
- 总下载量: 190.73k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 21
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2018-06-29