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 2w 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 41% 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

3181d ago

Major Versions

0.0.2.x-dev → 1.0.02017-10-14

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3583534?v=4)[Levin Mauritz](/maintainers/hefekranz)[@hefekranz](https://github.com/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.

9938.5M824](/packages/illuminate-session)[spatie/laravel-export

Create a static site bundle from a Laravel app

672139.5k6](/packages/spatie-laravel-export)[symfony/ux-autocomplete

JavaScript Autocomplete functionality for Symfony

635.5M36](/packages/symfony-ux-autocomplete)[illuminate/cookie

The Illuminate Cookie package.

224.5M132](/packages/illuminate-cookie)[numero2/contao-storelocator

Contao Plugin for managing stores (or in common address data) and providing a frontend-search based on geo data

121.6k](/packages/numero2-contao-storelocator)

PHPackages © 2026

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