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)0184.5k↓22.1%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 1mo ago

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 93% of packages

Maintenance42

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

461d 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://www.gravatar.com/avatar/46a970ba4587c88d738100fedf2840b09fc32691b16412c615531833e2cc74e3?d=identicon)[lebedevsky](/maintainers/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

[dmstr/yii2-db

Database extensions

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

Yii2 ActiveRecord supporting MySQL spatial data

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

A collection of useful helper classes for Yii framework 2.0

2022.5k5](/packages/mg-code-yii2-helpers)[craftcms/query

Execute database queries from the Control Panel

1614.5k1](/packages/craftcms-query)

PHPackages © 2026

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