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

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

shorif2000/pagination
=====================

creates a pagination control structure for a list of items

2.0(6y ago)05GPL-3.0-onlyPHPPHP &gt;=7.1

Since Nov 5Pushed 6y ago1 watchersCompare

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

READMEChangelog (3)Dependencies (1)Versions (3)Used By (0)

pagination demo
===============

[](#pagination-demo)

Creates a pagination control structure for a list of items. Support traversable list or collection and produce a data structure that defines a set of pagination parameters. (`array/ArrayObject` and possible a database connection asusming mysql).

Prerequisites
-------------

[](#prerequisites)

- Composer
- PhP 7.1

Installing
----------

[](#installing)

```
composer require shorif2000/pagination
```

### Usage

[](#usage)

#### Array

[](#array)

```
use Pagination\PaginatorFactory;
use Pagination\Lib\ArrayPageProvider;

...

$pageNumber = 1;
$itemsPerPage = 10;
$input = range(0, 100);
$input = array_slice($input, 0, 10);
$pagination = (new PaginatorFactory(new ArrayPageProvider($input)))->createPaginator($pageNumber, $itemsPerPage);
```

#### ArrayObject

[](#arrayobject)

```
use Pagination\PaginatorFactory;
use Pagination\Lib\ArrayObjectPageProvider;

...

$itemsPerPage = 10;
$input = range(0, 100);
$input = array_slice($input, 0, 10);
$input = new \ArrayObject($input);
$pageNumber = 1;
$pagination = (new PaginatorFactory(new ArrayObjectPageProvider($input)))->createPaginator($pageNumber, $itemsPerPage);
```

You can call the following functions to get data

```
    public function getItems();

    public function getCurrentPageNumber(): int;

    public function getNumberOfPages(): int;

    public function getTotal(): int;

    public function getTotalOnCurrentPage(): int;

    public function getTotalPerPage(): int;
```

#### Experimental

[](#experimental)

For database support.

```
use Pagination\PaginatorFactory;
use Pagination\Lib\DbPagintaor;

...

$pageNumber = 1;
$itemsPerPage = 10;
$input = range(0, 100);
$input = array_slice($input, 0, 10);
$pdo = ''; // mysql resource
$table = 'country';
$pagination = (new PaginatorFactory(new DbPagintaor($pdo, $table)))->createPaginator($pageNumber, $itemsPerPage);
```

### Running the tests

[](#running-the-tests)

`phpunit --debug tests/PaginatorTest.php`

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

Total

2

Last Release

2376d ago

Major Versions

1.0 → 2.02019-11-05

### Community

Maintainers

![](https://www.gravatar.com/avatar/170f72d717f5886fafa2a6f735bda30b6fca0eaa75965e1ccea680b1ba1221a1?d=identicon)[shorif2000](/maintainers/shorif2000)

---

Top Contributors

[![shorif2000](https://avatars.githubusercontent.com/u/6359089?v=4)](https://github.com/shorif2000 "shorif2000 (56 commits)")

---

Tags

pagination paginator

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[t3docs/examples

This extension packages a number of code examples from the Core Documentation.

3120.2k](/packages/t3docs-examples)

PHPackages © 2026

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