PHPackages                             ultimate-guitar/yii2-pq - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. ultimate-guitar/yii2-pq

ActiveYii2-extension[Database &amp; ORM](/categories/database)

ultimate-guitar/yii2-pq
=======================

A paged query class for Yii2 to deal with PHP7 changed in mysqlnd

1.2.1(1y ago)0192.1k↓65.6%PHPPHP &gt;=8.2

Since Oct 4Pushed 1y ago2 watchersCompare

[ Source](https://github.com/ultimate-guitar/yii2-pq)[ Packagist](https://packagist.org/packages/ultimate-guitar/yii2-pq)[ RSS](/packages/ultimate-guitar-yii2-pq/feed)WikiDiscussions master Synced yesterday

READMEChangelog (4)Dependencies (3)Versions (9)Used By (0)

yii2-pq
=======

[](#yii2-pq)

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
------------

[](#installation)

Just include it in your composer:

```
php composer require "sammaye/yii2-pq":"~1.0.0"

```

Usage
-----

[](#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?
----

[](#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](http://php.net/manual/en/mysqlinfo.concepts.buffering.php), buffering queries

Added to that, my own observations that unbuffered queries suck meant that I created this.

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance40

Moderate activity, may be stable

Popularity32

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity81

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~508 days

Recently: every ~605 days

Total

7

Last Release

507d ago

PHP version history (3 changes)1.0.0PHP &gt;=5.4.0

1.1.1PHP &gt;=5.5.0

1.2PHP &gt;=8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1124956?v=4)[Andrey Lebedevsky](/maintainers/lebedevsky)[@lebedevsky](https://github.com/lebedevsky)

---

Top Contributors

[![ovakilov](https://avatars.githubusercontent.com/u/134712694?v=4)](https://github.com/ovakilov "ovakilov (5 commits)")[![Sammaye](https://avatars.githubusercontent.com/u/323996?v=4)](https://github.com/Sammaye "Sammaye (5 commits)")[![KaRtON325](https://avatars.githubusercontent.com/u/42238036?v=4)](https://github.com/KaRtON325 "KaRtON325 (2 commits)")[![lebedevsky](https://avatars.githubusercontent.com/u/1124956?v=4)](https://github.com/lebedevsky "lebedevsky (2 commits)")

---

Tags

paginationquerydbyii2

### Embed Badge

![Health badge](/badges/ultimate-guitar-yii2-pq/health.svg)

```
[![Health](https://phpackages.com/badges/ultimate-guitar-yii2-pq/health.svg)](https://phpackages.com/packages/ultimate-guitar-yii2-pq)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[dmstr/yii2-db

Database extensions

19656.2k6](/packages/dmstr-yii2-db)[sjaakp/yii2-spatial

Yii2 ActiveRecord supporting MySQL spatial data

1878.8k1](/packages/sjaakp-yii2-spatial)[mg-code/yii2-helpers

A collection of useful helper classes for Yii framework 2.0

2023.3k5](/packages/mg-code-yii2-helpers)[mhthnz/yii2-tarantool

Tarantool connector for yii2 framework. Allows to perform SQL and NoSQL queries, ActiveRecord, Schemas and more.

121.3k](/packages/mhthnz-yii2-tarantool)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
