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

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

jinnguyen/puja-paginator
========================

Puja-Paginator is a flexible component for paginating collections of data and presenting that data to users.

v1.0.0(9y ago)039Apache License 2.0PHP

Since Jan 18Pushed 9y ago1 watchersCompare

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

READMEChangelog (1)DependenciesVersions (2)Used By (0)

puja-paginator
==============

[](#puja-paginator)

Puja-Paginator is a flexible component for paginating collections of data and presenting that data to users.

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

[](#installation)

Just run this on the command line:

```
composer require jinnguyen/puja-paginator

```

Usage
-----

[](#usage)

```
include '/path/to/vendor/autoload.php';
use Puja\Paginator\Paginator;
```

Examples:
---------

[](#examples)

**Simple**

```
$paginator = new Paginator(
    '/news/', // url
    100, // total of records
    10 // number of records per page
);
```

The rest of the documentation will assume you have a `$paginator` instance on which you are making calls.

### Adding renderer

[](#adding-renderer)

```
$paginator->addRenderer('simple', 'Puja\Paginator\Renderer\Simple'); // Puja\Paginator\Renderer\Simple must be extended of Puja\Paginator\Renderer\RendererAbstract
```

### Set labels

[](#set-labels)

```
$paginator->setLabels($labes); // default $labels is [First, Prev, Next, Last]
```

### First,Last and Current CSS classes

[](#firstlast-and-current-css-classes)

```

```

- [Home](/)
 // First element - [Page](/page)
- Subpage
 // Current Element - Subpage 2
 // Last Element
The first/last css classes are the class of first/last Breadcrumb element

```
$paginator->setFirstCssClassName($className);
$paginator->setLastCssClassName($className);
$paginator->setCurrentCssClassName($className);
```

### The Element

[](#the-element)

The default paging element is `%s{Divider}`. To change it, use the setElement method like so:

```
$paginator->setElement('%s{Divider}');
```

**Note:**

```
"%s" is required for Paginator::$element
{CssClassName}: will be replaced by Paginator::$firstCssClassName/Paginator::$currentCssClassName/Paginator::$lastCssClassName if this element is first/current/last element.
{Divider}: will be replaced by Paginator::$divider
```

### The List Element

[](#the-list-element)

The default list element used to wrap the paging, is `%s`. To change it, use the setListElement method like so:

```
$paginator->setListElement('%s');
```

**Note:**

```
"%s" is required for Paginator::$listElement
```

### Divider

[](#divider)

The default divider is `` (empty). This will be replace to placeholder {Divider} in property Paginator::$element. If you'd like to change it to, for example, `/`, you can just do:

```
$paginator->setDivider('/');
```

### Output

[](#output)

Finally, when you actually want to display your breadcrumbs, all you need to do is call the `render()` method on the instance:

```
echo $paginator->render('simple');
echo $paginator->render('basic');
echo $paginator->render(); // default is `basic`
```

**Note**

```
You can write custom Renderer by yourself. You can check Puja\Paginator\Renderer\Simple as a sample
```

**Example**

```
class CustomRenderer extends \Puja\Paginator\Renderer\RendererAbstract
{
    public function parse()
    {
        $p = '';
        for ($i = 0; $i < $this->paginator->getTotalPage(); $i++) {
            $p .= $this->paginator->getPageElement($i, true);
        }

        return $p;
    }
}

$paginator->addRenderer('custom', 'CustomRenderer');
$paginator->render('custom');
```

Note that by default First/Prev/Next/Last titles are rendered with escaping HTML characters, if you'd like to ignore it just do like so:

```
$paginator->setSafeHtml(false);
```

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 50% 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

Unknown

Total

1

Last Release

3447d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/25e5bd31b5dd70d47cbdc738bded06dbabfba3d584acce63c2c4b4fb7847f39d?d=identicon)[jinnguyen](/maintainers/jinnguyen)

---

Top Contributors

[![linhnmt](https://avatars.githubusercontent.com/u/10231628?v=4)](https://github.com/linhnmt "linhnmt (1 commits)")[![linhnnmt](https://avatars.githubusercontent.com/u/162856460?v=4)](https://github.com/linhnnmt "linhnnmt (1 commits)")

---

Tags

paginatorpuja

### Embed Badge

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

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

###  Alternatives

[nette/utils

🛠 Nette Utils: lightweight utilities for string &amp; array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.

2.1k417.9M1.7k](/packages/nette-utils)[knplabs/knp-components

Knplabs component library

77245.0M47](/packages/knplabs-knp-components)[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.

3741.3M21](/packages/jasongrimes-paginator)[beberlei/porpaginas

Library that generically solves several pagination issues with DAO/repository abstractions.

163632.5k13](/packages/beberlei-porpaginas)[laminas/laminas-paginator

Paginate collections of data from arbitrary sources

246.0M92](/packages/laminas-laminas-paginator)[coffeecode/paginator

Paginator is simple and is ready to generate results navigation in your application

12659.7k1](/packages/coffeecode-paginator)

PHPackages © 2026

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