PHPackages                             forrest79/pagination - 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. forrest79/pagination

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

forrest79/pagination
====================

Create pages list for pagination with logarithmic scale, neighbour pages or all pages.

v0.3.0(2y ago)01.6k11BSD-3-ClausePHPPHP ^8.0CI passing

Since Mar 10Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/forrest79/pagination)[ Packagist](https://packagist.org/packages/forrest79/pagination)[ RSS](/packages/forrest79-pagination/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (3)Versions (9)Used By (1)

Pagination
==========

[](#pagination)

[![Latest Stable Version](https://camo.githubusercontent.com/1b9584137c4810c27145cc01b7c4289702ea0e38ec70ad7ec6a1be2d3af1ddef/68747470733a2f2f706f7365722e707567782e6f72672f666f727265737437392f706167696e6174696f6e2f76)](//packagist.org/packages/forrest79/pagination)[![Monthly Downloads](https://camo.githubusercontent.com/03092219e799d33a376b59ef406de4d987f2721206935e9aa22b8916cfb2d34a/68747470733a2f2f706f7365722e707567782e6f72672f666f727265737437392f706167696e6174696f6e2f642f6d6f6e74686c79)](//packagist.org/packages/forrest79/pagination)[![License](https://camo.githubusercontent.com/57ce14ac138c77370926cbe8f7107f056d568c8bb32f61fc7cb28f493c37502e/68747470733a2f2f706f7365722e707567782e6f72672f666f727265737437392f706167696e6174696f6e2f6c6963656e7365)](//packagist.org/packages/forrest79/pagination)[![Build](https://github.com/forrest79/pagination/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/forrest79/pagination/actions/workflows/build.yml)

Create a page list for pagination with the logarithmic scale, neighbor pages or all pages.

Algorithms are copied from .

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

[](#installation)

The recommended way to install Forrest79/Pagination is through Composer:

```
composer require forrest79/pagination
```

How to use it
-------------

[](#how-to-use-it)

Just call `PagesFactory::` with the page list you want:

```
$pages = Forrest79\Pagination\PagesFactory::all(100);
$pages = Forrest79\Pagination\PagesFactory::neighbour(100, 1, 5);
$pages = Forrest79\Pagination\PagesFactory::logarithmic(100, 10, 10);
```

You will get sorted `array` with `integer` pages numbers. For neighbor and logarithmic scale, there are also `null` values at place, where is broken pages series, for example: `[1, 2, 3, null, 7, 8]`. So you know where to print space. You can disable this behavior by settings parameter `$addGaps` to `false`.

### Example with Nette

[](#example-with-nette)

Simple using with default paginator:

```
class Paginator extends Nette\Utils\Paginator
{

	public function pages(): array
	{
		if ($this->getPageCount() === null) {
			throw new InvalidArgumentException('We need page count set to generate pages list');
		}
		return Forrest79\Pagination\PagesFactory::logarithmic($this->getPageCount(), $this->getPage(), 10);
	}

}
```

And in `latte`:

```

	{if $page === null}
		..
	{else}
		{$page}
	{/if}

```

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity61

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 ~236 days

Recently: every ~388 days

Total

8

Last Release

1021d ago

PHP version history (3 changes)v0.1.0PHP &gt;=7.1

v0.2.0PHP ^7.4 | ^8.0

v0.3.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/d979cd353c6593b44b50f90ff5a5eb4be224f501a70f7cce89d0735867e488e5?d=identicon)[forrest79](/maintainers/forrest79)

---

Top Contributors

[![forrest79](https://avatars.githubusercontent.com/u/160766?v=4)](https://github.com/forrest79 "forrest79 (38 commits)")

---

Tags

phppaginatorpaginationpageslogarithmicneighbour

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/forrest79-pagination/health.svg)

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

###  Alternatives

[jasongrimes/paginator

A lightweight PHP paginator, for generating pagination controls in the style of Stack Overflow and Flickr. The 'first' and 'last' page links are shown inline as page numbers, and excess page numbers are replaced by ellipses.

4091.3M22](/packages/jasongrimes-paginator)[stefangabos/zebra_pagination

A generic, Twitter Bootstrap compatible, PHP pagination library that automatically generates navigation links

11923.8k](/packages/stefangabos-zebra-pagination)[lampager/lampager

Rapid pagination without using OFFSET

3780.1k6](/packages/lampager-lampager)

PHPackages © 2026

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