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

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

mps/pagination
==============

php flexible pagination

v1.2(10y ago)04.8kMITPHPPHP &gt;=5.3.0

Since Aug 7Pushed 10y ago1 watchersCompare

[ Source](https://github.com/Motorpresse/pagination)[ Packagist](https://packagist.org/packages/mps/pagination)[ Docs](https://github.com/Motorpresse/pagination)[ RSS](/packages/mps-pagination/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)DependenciesVersions (4)Used By (0)

A generic pagination iterator
=============================

[](#a-generic-pagination-iterator)

This repository provides a couple of php-classes for generic paginations. The main class is **PaginationIterator**. It permits iterating over a set of integer values. Depending on the previous and next value it either returns a **PageItem**-Object or a **GapItem**-Object.

Several classes implementing the **PaginationFactoryInterface** may be used to create **PaginationIterators** for several purposes.

PaginationIteratorInterface
---------------------------

[](#paginationiteratorinterface)

A class which implements the **PaginationIteratorInterface** allows to iterate over a set of numbers which represent pages in a pagination. It takes an array as its only constructor argument. When iterating over the object it will return either an object implementing the **PageItemInterface**for each integer number in the sorted constructor array or an object implementing the **GapItemInterface** for each gap between the numbers.

Objects which implement the **PaginationIteratorInterface** provide the methods *setGapItemClass()*and *setPageItemClass()*. They may be used to determine which classes the respective objects should instantiate.

The repository provides a class **PaginationIterator** which implements the **PaginationIteratorInterface**and the classes **GapItem** and **PageItem** which implement the respective interfaces.

PaginationFactoryInterface
--------------------------

[](#paginationfactoryinterface)

Classes which implement the **PaginationFactoryInterface** help producing new objects implementing the **PaginationIteratorInterface**. They must provide a *makeNewPagination* method. This method takes four arguments:

- int **$max**: the last page in the pagination
- int **$steps**: the number of pages that the pagination should show / link to.
- int **$current**: the page currently shown
- int **$min**: the first page in the pagination

The repository provides several implementations of the **PaginationFactoryInterface**:

- **FullPaginationFactory**: paginations produced by this factory will list each page in the pagination and ignore the *$steps* and *$current* arguments
- **LogPaginationFactory**: paginations produced by this factory will list the current page, the first and the last page and *$step* pages in a distance from a^0 to a^n (respectivley a^m) with a^n = $min (and a^m = $max).
- **NeighbourPaginationFactory**: pagination produced by this factory will list the first, the last, and the current page as well as several pages in the direct neighbourhood of the current page.
- **StepPaginationFactory**: paginations produced by this factory will list the first, the last, the current, the previous, and the next page as well as several pages between the first and the last page in equal distance.

Example
-------

[](#example)

```
$pagination = LogPaginationFactory::makeNewPagination(100, 20, 35);

foreach ($pagination as $item) {
	if ($item instanceof GapItemInterface) {
		echo '...';
	} elseif ($item instanceof PageItemInterface) {
		echo ''.$item->getPageNumber().'&nbsp;|&nbsp;';
	}
}

```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 83.3% 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 ~2 days

Total

3

Last Release

3934d ago

### Community

Maintainers

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

---

Top Contributors

[![nikolassv](https://avatars.githubusercontent.com/u/1006908?v=4)](https://github.com/nikolassv "nikolassv (5 commits)")[![Starbuck2511](https://avatars.githubusercontent.com/u/3884444?v=4)](https://github.com/Starbuck2511 "Starbuck2511 (1 commits)")

### Embed Badge

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

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

PHPackages © 2026

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