PHPackages                             wake/pager - 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. wake/pager

ActiveLibrary[Database &amp; ORM](/categories/database)

wake/pager
==========

A lightweight PHP paginator.

v0.1.4.1(4y ago)12312MITPHPPHP &gt;=5.2.0

Since Aug 24Pushed 3y ago1 watchersCompare

[ Source](https://github.com/wake/pager)[ Packagist](https://packagist.org/packages/wake/pager)[ Docs](https://github.com/wake/pager)[ RSS](/packages/wake-pager/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (6)DependenciesVersions (10)Used By (2)

Pager
=====

[](#pager)

A lightweight PHP paginator.

Installation
------------

[](#installation)

Add in your `composer.json` with following require entry:

```
{
  "require": {
    "wake/pager": "*"
  }
}
```

or using composer:

```
$ composer require wake/pager:*
```

then run `composer install` or `composer update`.

Usage: Pager
------------

[](#usage-pager)

Use Pager without any ORM.

```
Use Pager\Pager;

$pager = new Pager ();

$pager->total (1000) // 1000 data items
  ->page (13)        // Set current page to no.13
  ->paging ();

// First page: 1
echo $pager->pages->top;

// Last page (total pages): 67
echo $pager->pages->end;

// First page of page group: 8
echo $page->pages->first;

// Last page of page group: 17
echo $page->pages->last;

// Next page: 14
echo $page->pages->next;

// Next 10 page: 24
echo $page->pages->next10;

// Pages
foreach ($pager->pages as $page)
  echo $page . "";

// Page url
foreach ($pager->pages as $page)
  echo $page->url . "";
```

### `$pager->show ($show)`

[](#pager-show-show)

Set amount of items per page, default to `15`.

```
// Display 12 items on each page.
$pager->show (12);
```

### `$pager->total ($total)`

[](#pager-total-total)

Set total amount of items.

```
// Set total amount of 100.
$pager->total (100);
```

### `$pager->size ($size)`

[](#pager-size-size)

Set amount of page list per page, default to `10`.

```
// Display 5 pages of page group on each page - `1 2 3 4 5`
$pager->size (5);
```

### `$pager->page ($page)`

[](#pager-page-page)

Set current page, default to `1`.

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

### `$pager->dynamic ()`, `$pager->fixed ()`

[](#pager-dynamic--pager-fixed-)

List pages of page group dynamically or fixed, default is `dynamic`.

```
// List dynamically: `1 2 3 4 5` -> `2 3 4 5 6` -> `3 4 5 6 7`
$pager->dynamic ();

// List fixed: `1 2 3 4 5` -> `6 7 8 9 10`
$pager->fixed ();
```

### `$pager->url ($pattern)`

[](#pager-url-pattern)

Set url pattern or handler function, default is pattern `(:num)`.

```
// /?page=3
$pager->url ('/?page=(:num)');

// /?p=3
$pager->url (function ($pageItem) {
  return '/?p=' . $pageItem->num;
});
```

### `$pager->paging ()`

[](#pager-paging-)

Calculate and build page items, must be called after all options are set.

```
$pager->paging ();
```

Usage: Pages
------------

[](#usage-pages)

Container of page items.

```
Use Pager\Pager;

$pager = new Pager ();

$pager->total (1000) // 1000 data items
  ->page (13)        // current page is no.13
  ->paging ();

$pages = $pager->pages;
```

### `$pages->top`

[](#pages-top)

First page of all pages, generally is 1.

### `$pages->end`

[](#pages-end)

Last page of all pages.

### `$pages->first`

[](#pages-first)

First page of page group.

### `$pages->last`

[](#pages-last)

Last page of page group.

### `$pages->total`

[](#pages-total)

Total amount of pages.

### `$pages->current`, `$pages->page`

[](#pages-current-pages-page)

Current page.

### `$pages->next`

[](#pages-next)

Next page.

### `$pages->prev`

[](#pages-prev)

Previous page.

### `$pages->next*N`

[](#pages-nextn)

Next `N` page.

```
// Next page
$pages->next;
$pages->next1;

// Next 5 page
$pages->next5;
```

### `$pages->prev*N`

[](#pages-prevn)

Previous `N` page.

```
// Previous page
$pages->prev;
$pages->prev1;

// Previous 5 page
$pages->prev5;
```

Usage: Page item
----------------

[](#usage-page-item)

Page item.

```
Use Pager\Pager;

$pager = new Pager ();

$pager->total (1000) // 1000 data items
  ->page (13)        // current page is no.13
  ->paging ();

$item = $pager->pages->first;
```

### `$item`, `$item->num`

[](#item-item-num)

Number of the page, $item could be use as string directly.

```
echo $item;
echo $item->num;
```

### `$item->url ()`

[](#item-url-)

Url of the page.

```
echo $item->url ();
```

Feedback
--------

[](#feedback)

Please feel free to open an issue and let me know if there is any thoughts or questions 😃

License
-------

[](#license)

Released under the MIT license

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity54

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

Every ~227 days

Recently: every ~186 days

Total

8

Last Release

1591d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7224160511f2f5bc6da7c7291c93c8336ada313c5b13d8d50827f95d75808d1f?d=identicon)[Wake](/maintainers/Wake)

---

Top Contributors

[![wake](https://avatars.githubusercontent.com/u/746821?v=4)](https://github.com/wake "wake (39 commits)")

---

Tags

paginatorormpagination

### Embed Badge

![Health badge](/badges/wake-pager/health.svg)

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

###  Alternatives

[pagerfanta/pagerfanta

Pagination for PHP

42550.0M245](/packages/pagerfanta-pagerfanta)[data-dog/pager-bundle

Paginator bundle for symfony2 and doctrine orm, allows customization with filters and sorters

11103.5k7](/packages/data-dog-pager-bundle)[tommyknocker/pdo-database-class

Framework-agnostic PHP database library with unified API for MySQL, MariaDB, PostgreSQL, SQLite, MSSQL, and Oracle. Query Builder, caching, sharding, window functions, CTEs, JSON, migrations, ActiveRecord, CLI tools, AI-powered analysis. Zero external dependencies.

845.7k](/packages/tommyknocker-pdo-database-class)[paysera/lib-pagination

Paginates Doctrine QueryBuilder using cursor based or offset based pagination

13191.8k1](/packages/paysera-lib-pagination)

PHPackages © 2026

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