PHPackages                             rgehan/paginator - 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. rgehan/paginator

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

rgehan/paginator
================

A simple PHP paginator

1.0.2(9y ago)019MITPHP

Since Apr 19Pushed 9y agoCompare

[ Source](https://github.com/rgehan/paginator-php)[ Packagist](https://packagist.org/packages/rgehan/paginator)[ RSS](/packages/rgehan-paginator/feed)WikiDiscussions master Synced 3w ago

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

[rgehan/paginator-php](https://github.com/rgehan/paginator-php)
---------------------------------------------------------------

[](#rgehanpaginator-php)

This is a quick implementation of a paginator for a project

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

[](#installation)

Simply require it with composer:

```
composer require rgehan/paginator

```

Usage
-----

[](#usage)

```
define('ITEMS_PER_PAGE', 3);

// Gets the count of articles
$articlesCount = 10; // You might want to load that from the database

// Makes pagination
$paginator = new Paginator($articlesCount, self::ITEMS_PER_PAGE);
$paginator->setURLFormatString("http://localhost/articles?page=%d");

// Gets the page we want to access
if(isset($_GET['page']))
    $page = $paginator->getValidPage($_GET['page']); // Returns a page in the range of the existing pages
else
    $page = 0;

// Fetches the articles
$startIndex = $page * self::ITEMS_PER_PAGE;
$articles = do_sql_query("SELECT * FROM articles LIMIT " . $startIndex . ", " . ITEMS_PER_PAGE); // Pseudo-code for SQL query

// Creates the pagination
$pagination = $paginator->generateLinks($page);

/*
    Let's say: $page = 2

    Outputs:
    [
        [
            'url' => 'http://localhost/articles?page=0',
            'index' => 0,
            'current' => false
        ],[
            'url' => 'http://localhost/articles?page=1',
            'index' => 1,
            'current' => false
        ],[
            'url' => 'http://localhost/articles?page=2',
            'index' => 2,
            'current' => true
        ],[
            'url' => 'http://localhost/articles?page=3',
            'index' => 3,
            'current' => false
        ],
        ...
    ]
 */
```

You can then pass the output of `$paginator->generateLinks($page)` to your view and render your links as you wish.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity65

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

Total

3

Last Release

3356d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/854a3448bd60de8dfe634d4cd40bb8e359c68086e63ab08c19d2aa6e6a2b8c55?d=identicon)[rgehan](/maintainers/rgehan)

---

Top Contributors

[![rgehan](https://avatars.githubusercontent.com/u/793402?v=4)](https://github.com/rgehan "rgehan (6 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rgehan-paginator/health.svg)

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

PHPackages © 2026

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