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

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

hefekranz/pagination
====================

a simple lib to create a pagination from a symfony request

1.0.0(8y ago)0118MITPHPPHP ^7.0

Since May 22Pushed 8y agoCompare

[ Source](https://github.com/hefekranz/pagination)[ Packagist](https://packagist.org/packages/hefekranz/pagination)[ RSS](/packages/hefekranz-pagination/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (2)Versions (4)Used By (0)

Pagination
==========

[](#pagination)

[![Build Status](https://camo.githubusercontent.com/a22c5f90a9c86475dae5790414e93d35815d15ff51acc37f836af872c6a88126/68747470733a2f2f7472617669732d63692e6f72672f686566656b72616e7a2f706167696e6174696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/hefekranz/pagination)[![Coverage](https://camo.githubusercontent.com/4c5cc1b1ea958dadfc39130fed9b5af80f3312e68fbc6b1ad2893c2a36f4c56f/68747470733a2f2f636f6465636f762e696f2f67682f686566656b72616e7a2f706167696e6174696f6e2f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/hefekranz/pagination)

This is a very simple one. You take a request. You take the count of whatever items you want to display.
You put them together, you get a pagination object.

### Installation

[](#installation)

```
composer require hefekranz/pagination

```

### Usage

[](#usage)

Quick Example for `GET /collection?page=2&limit=10` on a collection of 100 items

```
    public function getMeSomeCollectionAction(Request $request) {

        $data = $objectRepo->findAll();

        $pagination = (new Pagination($objectRepo->count(), $request))->build();

        return new JsonResponse([
            "pagination" => $pagination->toArray(),
            "data"       => $data->toArray()
        ]);
    }
```

Would produce

```
{
    "pagination": {
        "total": 100,
        "pages": {
            "first": 1,
            "previous": 1,
            "current": 1,
            "next": 2,
            "last": 5
        },
        "links": {
            "first": "/collection?page=1&limit=20",
            "previous": "/collection?page=1&limit=20",
            "current": "/collection?page=1&limit=20",
            "next": "/collection?page=2&limit=20",
            "last": "/collection?page=5&limit=20"
        }
    },
    "data": [
        {},
        {},
        {}
    ]
}
```

The class expects a Symfony\\HttpFoundation\\Request object. If you dont have one, build it.
From the global request, or your custom implementation.

```
        $request = Request::create("/collection","GET",["page" => 2,"limit" => 10]);
        /** or Request::createFromGlobals() */
        $pagination = (new Pagination($objectRepo->count(), $request))->build();
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity60

Established project with proven stability

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

Total

3

Last Release

3134d ago

Major Versions

0.0.2.x-dev → 1.0.02017-10-14

### Community

Maintainers

![](https://www.gravatar.com/avatar/9af629fc42d926a6c807a686ab6613e81824e4a3e941fe9db814a7dab3562a95?d=identicon)[hefekranz](/maintainers/hefekranz)

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[illuminate/session

The Illuminate Session package.

9937.4M753](/packages/illuminate-session)[illuminate/cookie

The Illuminate Cookie package.

224.3M122](/packages/illuminate-cookie)[codefog/contao-haste

haste extension for Contao Open Source CMS

42650.8k139](/packages/codefog-contao-haste)[codefog/contao-news_categories

News Categories bundle for Contao Open Source CMS

3183.3k6](/packages/codefog-contao-news-categories)[netgen/content-browser

Netgen Content Browser is a Symfony bundle that provides an interface which selects items from any kind of backend and returns the IDs of selected items back to the calling code.

14112.1k8](/packages/netgen-content-browser)[leapt/core-bundle

Symfony LeaptCoreBundle

2529.1k4](/packages/leapt-core-bundle)

PHPackages © 2026

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