PHPackages                             phpixie/paginate - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. phpixie/paginate

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

phpixie/paginate
================

Pagination library for PHPixie

3.1.1(8y ago)322.4k2[1 PRs](https://github.com/PHPixie/Paginate/pulls)2BSD-3-ClausePHP

Since Sep 8Pushed 8y ago1 watchersCompare

[ Source](https://github.com/PHPixie/Paginate)[ Packagist](https://packagist.org/packages/phpixie/paginate)[ Docs](http://phpixie.com)[ RSS](/packages/phpixie-paginate/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (5)Used By (2)

Paginate
========

[](#paginate)

PHPixie Pagination library

[![Build Status](https://camo.githubusercontent.com/383049beabcbf73da26089c6ac653b0653c44c71562acb985faeffe80f780f4e/68747470733a2f2f7472617669732d63692e6f72672f504850697869652f506167696e6174652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/PHPixie/Paginate)[![Test Coverage](https://camo.githubusercontent.com/1111a9e79b9608fbf460fff37e643861e0a022c05e799498689b33503a117763/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f504850697869652f506167696e6174652f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/PHPixie/Paginate)[![Code Climate](https://camo.githubusercontent.com/d926f4c36908be1073872864352a5bf84db901131d47cdc268b9bfb53f00d74b/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f504850697869652f506167696e6174652f6261646765732f6770612e737667)](https://codeclimate.com/github/PHPixie/Paginate)[![HHVM Status](https://camo.githubusercontent.com/ccbf1f401c1a73c7a647876a498f809c5aaffa26c8e0f1606287ff1b76bd5740/68747470733a2f2f696d672e736869656c64732e696f2f6868766d2f706870697869652f706167696e6174652e7376673f7374796c653d666c61742d737175617265)](http://hhvm.h4cc.de/package/phpixie/paginate)

[![Author](https://camo.githubusercontent.com/24a0a94bb83eb81ba03c32074967dc730174cfd2849e984169db461d955cdbb9/687474703a2f2f696d672e736869656c64732e696f2f62616467652f617574686f722d40647261636f6e792d626c75652e7376673f7374796c653d666c61742d737175617265)](https://twitter.com/dracony)[![Source Code](https://camo.githubusercontent.com/896dc589b71e80ee613ef0e3a9efa395f4b11546a83c16a08e69e552d57ccd1d/687474703a2f2f696d672e736869656c64732e696f2f62616467652f736f757263652d706870697869652f706167696e6174652d626c75652e7376673f7374796c653d666c61742d737175617265)](https://github.com/phpixie/paginate)[![Software License](https://camo.githubusercontent.com/b60331a2084501dc07cf6d6964c0da58dd005d89c45cf3b28b4b22b60f5ec00f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4253442d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/phpixie/paginate/blob/master/LICENSE)[![Total Downloads](https://camo.githubusercontent.com/555671ffc92e061d4a56867c64da5d321f0bdda447ecb083d5e8452dfb105261/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f706870697869652f706167696e6174652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/phpixie/paginate)

This is the base package for PHPixie Pagination that is split into several components.

```
// Initializing
$paginate = new \PHPixie\Paginate();
```

The base library cn only paginate arrays, there is an ORM extension available too, which we will look at further on. First let's see a usage example:

```
// Array with a 100 items
$data = range(1, 100);

// Initialize the pager
// with 15 items per page
$pager = $paginate->arrayPager($data, 15);

// Set current page
$pager->setCurrentPager(3);

// A shorter way to do this:
$pager = $paginate->arrayPager($data, 15)
    ->setCurrentPage(3);

// Get some data
$pager->currentPage(); // 3
$pager->pageSize();    // 15
$pager->itemCount();   // 100
$pager->pageCount();   // 7

// Get current items
$pager->currentItems();

// Check if page exists:
$pager->pageExists(1); // true

// Check if a page exists
// relative to the current one
$this->pageOffsetExists(-1); // true

// Get page number by relative offset
// Will return null if the page is missing
// In this case 4, since 3 is the current one
$this->getPageByOffset(1);

// Some shorthands,
// also return null if page missing
$this->next(); // 4
$this->previous(); // 2
```

A more interesting feature is getting pages adjacent to the current one, which is useful for rendering the pager.

```
// 15 items, split into 6 pages
$data = range(1, 18);
$pager = $paginate->arrayPager($data, 3);

$pager->setCurrentPage(3);

$pager->getAdjacent(3); // array(2, 3, 4);

$pager->setCurrentPage(1);
$pager->getAdjacent(2); // array(1, 2);

$pager->setCurrentPage(5);
$pager->getAdjacent(4); // array(3, 4, 5, 6);
```

ORM
---

[](#orm)

First we need to build the ORM pagination library:

```
$paginate = new \PHPixie\Paginate();
$paginateOrm = new \PHPixie\PaginateORM($paginate);
```

ORM pagination supports relationship preloading:

```
$pager = $paginateOrm->queryPager($query, 15);

// Or with the relationships specified
$pager = $paginateOrm->queryPager($query, 15, array('items'));
```

It will also consider the limit and offset you specified for the query. This means if you limit the items in the query before creating the pager, only those items will be paged:

```
$query->limit(100)->offset(10);
$pager = $paginateOrm->queryPager($query, 15);

// Only those 100 items
// are in the pager
$pager->itemCount(); // 100
```

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity66

Established project with proven stability

 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

Every ~297 days

Total

4

Last Release

3014d ago

Major Versions

2.x-dev → 3.02015-10-11

### Community

Maintainers

![](https://www.gravatar.com/avatar/2fd2ee997c779cf774247d3d4cde7d90491484f817032aab6dbc314857973b36?d=identicon)[dracony](/maintainers/dracony)

---

Top Contributors

[![dracony](https://avatars.githubusercontent.com/u/3127080?v=4)](https://github.com/dracony "dracony (9 commits)")

---

Tags

paginationpaginate

### Embed Badge

![Health badge](/badges/phpixie-paginate/health.svg)

```
[![Health](https://phpackages.com/badges/phpixie-paginate/health.svg)](https://phpackages.com/packages/phpixie-paginate)
```

###  Alternatives

[wenzhixin/bootstrap-table

An extended table to integration with some of the most widely used CSS frameworks. (Supports Bootstrap, Semantic UI, Bulma, Material Design, Foundation)

11.8k283.4k1](/packages/wenzhixin-bootstrap-table)[babdev/pagerfanta-bundle

Bundle integrating Pagerfanta with Symfony

20917.8M65](/packages/babdev-pagerfanta-bundle)[aplus/pagination

Aplus Framework Pagination Library

2091.6M3](/packages/aplus-pagination)[kop/yii2-scroll-pager

Infinite AJAX scrolling for Yii2 ListView widget

180706.5k10](/packages/kop-yii2-scroll-pager)[coffeecode/paginator

Paginator is simple and is ready to generate results navigation in your application

59658.1k1](/packages/coffeecode-paginator)[beberlei/porpaginas

Library that generically solves several pagination issues with DAO/repository abstractions.

163612.6k11](/packages/beberlei-porpaginas)

PHPackages © 2026

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