PHPackages                             hectororm/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. [Database &amp; ORM](/categories/database)
4. /
5. hectororm/pagination

ActiveLibrary[Database &amp; ORM](/categories/database)

hectororm/pagination
====================

Hector Pagination

01PHP

Since Mar 20Pushed 1mo agoCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Hector Pagination
=================

[](#hector-pagination)

[![Latest Version](https://camo.githubusercontent.com/7a4586336f8e74d2f49fc9ef942ec7a0a84395aa154f507cb222a4e58d6e9c7d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f686563746f726f726d2f706167696e6174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/hectororm/pagination/releases)[![Packagist Dependency Version](https://camo.githubusercontent.com/483c49af05f7ef374da364406d38f08915b7c8547ff72f49716f80b7e4e6b69d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f686563746f726f726d2f706167696e6174696f6e2f7068703f76657273696f6e3d6465762d6d61696e267374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/483c49af05f7ef374da364406d38f08915b7c8547ff72f49716f80b7e4e6b69d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f686563746f726f726d2f706167696e6174696f6e2f7068703f76657273696f6e3d6465762d6d61696e267374796c653d666c61742d737175617265)[![Software license](https://camo.githubusercontent.com/d9e50ce567bbbe93b4f1d0a70286b6d86b4a59cfbf811b386e8eff4b14feaefd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f686563746f726f726d2f706167696e6174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/hectororm/pagination/blob/main/LICENSE)

> **Note**
>
> This repository is a **read-only split** from the [main HectorORM repository](https://github.com/hectororm/hectororm).
>
> For contributions, issues, or more information, please visit the [main HectorORM repository](https://github.com/hectororm/hectororm).
>
> **Do not open issues or pull requests here.**

---

**Hector Pagination** provides a set of interfaces and implementations for handling pagination in PHP applications. It supports multiple pagination strategies: offset-based, cursor-based (keyset), and range-based pagination.

📖 **[Full documentation](https://gethectororm.com/docs/current/components/pagination)**

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

[](#installation)

```
composer require hectororm/pagination
```

Pagination Types
----------------

[](#pagination-types)

TypeClassUse CaseOffset`OffsetPagination`Simple page-based navigationCursor`CursorPagination`Keyset pagination for large datasetsRange`RangePagination`RFC 7233 style (Content-Range headers)Quick Start
-----------

[](#quick-start)

```
use Hector\Pagination\OffsetPagination;
use Hector\Pagination\Paginator\OffsetPaginator;

// 1. Create paginator (injectable as service)
$paginator = new OffsetPaginator(
    pageParam: 'page',
    perPageParam: 'per_page',
    defaultPerPage: 15,
    maxPerPage: 100,
);

// 2. Parse request: ?page=3&per_page=20
$request = $paginator->createRequest($serverRequest);

// 3. Query your data
$results = $repository->findAll($request->getLimit(), $request->getOffset());

// 4. Build pagination
$pagination = new OffsetPagination(
    items: $results,
    perPage: $request->perPage,
    currentPage: $request->page,
    hasMore: count($results) >= $request->perPage,
);

// 5. Prepare response with Link headers
$response = $paginator->prepareResponse($response, $serverRequest->getUri(), $pagination);
```

Features
--------

[](#features)

- **Paginators**: High-level API for request parsing and response preparation
- **Navigators**: Generate navigation links (first, prev, next, last)
- **URI Builders**: Customizable query parameter generation
- **Cursor Encoders**: Base64 and HMAC-signed cursors
- **Cursor Storage**: Server-side cursor state (PSR-16 cache)
- **JSON Serialization**: All pagination classes implement `JsonSerializable`
- **PSR-7 Compatible**: Works with any PSR-7 implementation

📖 **[See full documentation for all features](https://gethectororm.com/docs/current/components/pagination)**

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance58

Moderate activity, may be stable

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/18268216?v=4)[Ronan Giron](/maintainers/ElGigi)[@ElGigi](https://github.com/ElGigi)

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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