PHPackages                             sammaye/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. sammaye/yii2-pq

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

sammaye/yii2-pq
===============

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

1.0.0(9y ago)454.2k↓50%2PHPPHP &gt;=5.4.0

Since Oct 4Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Sammaye/yii2-pq)[ Packagist](https://packagist.org/packages/sammaye/yii2-pq)[ RSS](/packages/sammaye-yii2-pq/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)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

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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

Unknown

Total

1

Last Release

3508d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7357836d822160350576f98b85244f4d5f960be303a2fcaa15a330187966cbd4?d=identicon)[Sammaye](/maintainers/Sammaye)

---

Top Contributors

[![Sammaye](https://avatars.githubusercontent.com/u/323996?v=4)](https://github.com/Sammaye "Sammaye (5 commits)")

---

Tags

paginationquerydbyii2

### Embed Badge

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

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

###  Alternatives

[envms/fluentpdo

FluentPDO is a quick and light PHP library for rapid query building. It features a smart join builder, which automatically creates table joins.

925511.7k13](/packages/envms-fluentpdo)[lichtner/fluentpdo

FluentPDO is a quick and light PHP library for rapid query building. It features a smart join builder, which automatically creates table joins.

921274.8k6](/packages/lichtner-fluentpdo)[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)[craftcms/query

Execute database queries from the Control Panel

1614.5k1](/packages/craftcms-query)[omalizadeh/laravel-query-filter

A laravel package for resource filtering via request query string

163.0k](/packages/omalizadeh-laravel-query-filter)

PHPackages © 2026

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