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

Abandoned → [arturdoruch/list-bundle](/?search=arturdoruch%2Flist-bundle)ArchivedSymfony-bundle[Utility &amp; Helpers](/categories/utility)

arturdoruch/paginator-bundle
============================

Simple paginator for Symfony2

1.1.3(6y ago)0934MITPHPPHP &gt;=5.3.3

Since Dec 6Pushed 6y agoCompare

[ Source](https://github.com/arturdoruch/PaginatorBundle)[ Packagist](https://packagist.org/packages/arturdoruch/paginator-bundle)[ RSS](/packages/arturdoruch-paginator-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (6)Used By (0)

PaginatorBundle
===============

[](#paginatorbundle)

Simple paginator for Symfony2, which can paginate:

- array
- Doctrine\\ORM\\Query
- Doctrine\\ORM\\QueryBuilder
- Doctrine\\ODM\\MongoDB\\Query\\Builder
- Doctrine\\ODM\\MongoDB\\Query\\Query
- Doctrine\\MongoDB\\CursorInterface
- MongoCursor

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

[](#installation)

Add the following line to your composer.json require block

```
"require": {
    ...
    "arturdoruch/paginator-bundle": "~1.0"
}
```

and run composer command

```
composer update arturdoruch/paginator-bundle
```

or simply

```
composer require arturdoruch/paginator-bundle
```

Register ArturDoruchPaginatorBundle in your application kernel class

```
// app/AppKernel.php
public function registerBundles()
{
    return array(
        // ...
        new ArturDoruch\PaginatorBundle\ArturDoruchPaginatorBundle(),
    );
}
```

Configuration
-------------

[](#configuration)

```
// app/config/config.yml

artur_doruch_paginator:
    limit: 10                        # Default value of displayed items per page
    prev_page_label: '&#8592; Prev'  # Pagination previous page button label
    next_page_label: 'Next &#8594;'  # Pagination next page button label
```

Usage
-----

[](#usage)

### Controller

[](#controller)

Get paginator in controller method.

```
$paginator = $this->get('arturdoruch_paginator');
```

Paginate items list.

```
$paginator->paginate($query, $page, $limit);
```

ArturDoruch\\PaginatorBundle\\Paginator::paginate() method receive three parameters:

- $query (mixed) A Doctrine ORM query or query builder, Doctrine mongodb ODM query or query builder, instance of Doctrine\\MongoDB\\CursorInterface, instance of MongoCursor, or array with arrays of items.
- $page (integer) Number of page to display
- $limit (integer) The number of items per page. Possible values are:
    - -1 - fetch all items (limit will be omitted)
    - 0 - default limit (setting in config "artur\_doruch\_paginator.limit") will be used
    - integer positive - given $limit value will be used

#### Examples

[](#examples)

Paginate items with Doctrine ORM query and query builder.

```
// AppBundle\Controller\ProjectController.php

public function listAction($page, Request $request)
{
    $repository = $this->getDoctrine()->getRepository('AcmeProjectBundle:Project');
    $paginator = $this->get('arturdoruch_paginator');

    // Doctrine\ORM\QueryBuilder
    $qb = $repository->createQueryBuilder('p')
        ->select('p');

    $projects = $paginator->paginate($qb, $page, 5);

    // Doctrine\ORM\Query
    $query = $repository->createQueryBuilder('p')
        ->select('p')
        ->getQuery();

    $projects = $paginator->paginate($query, $page, 5);

    return $this->render('AppBundle:Project:list.html.twig', array(
        'projects' => $projects
    ));
}
```

Paginate items with Doctrine ODM MongoDB query and query builder.

```
// todo
```

Paginate items with Doctrine\\MongoDB\\CursorInterface and MongoCursor.

```
// todo
```

Paginate items from array. Array can contain array or object collection.

```
// AppBundle\Controller\ProjectController.php

public function listAction($page, Request $request)
{
    $projectsList = array(
            array(
                'id' => 1,
                'name' => 'PHP'
            ),
            array(
                'id' => 2,
                'name' => 'JS'
            ),
            array(
                'id' => 3,
                'name' => 'Symfony'
            ),
            array(
                'id' => 4,
                'name' => 'Github'
            ),
            array(
                'id' => 5,
                'name' => 'SCSS'
            )
            ...
        );

    $paginator = $this->get('arturdoruch_paginator');
    $projects = $paginator->paginate($projectsList, $page, 5);

    return $this->render('AppBundle:Project:list.html.twig', array(
        'projects' => $projects
    ));
}
```

### View

[](#view)

In twig template you can use several functions to display all paginate list data. Each of them require Pagination class instance as parameter. See example below.

```
{# Pagination #}
{{ arturdoruch_pagination(projects.pagination) }}

{# Displayed items range #}
{{ arturdoruch_pagination_displayed_items(projects.pagination) }}

{# Total items count #}
{{ arturdoruch_pagination_total_items(projects.pagination) }}

{# Renders all pagination parts: pagination, items range, total items #}
{{ arturdoruch_pagination_all(projects.pagination) }}

            Id
            Name

    {% for project in projects %}

            {{ project.id }}
            {{ project.name }}

    {% endfor %}

```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity62

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

Total

5

Last Release

2351d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5af341236bd5f7de04934e7b63ab71d774df81f5409e7fafd19ede18c0cd6c2a?d=identicon)[arturdoruch](/maintainers/arturdoruch)

---

Top Contributors

[![arturdoruch](https://avatars.githubusercontent.com/u/6686928?v=4)](https://github.com/arturdoruch "arturdoruch (26 commits)")

---

Tags

bundlepaginatorpaginationSymfony2

### Embed Badge

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

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

###  Alternatives

[stfalcon/tinymce-bundle

This Bundle integrates TinyMCE WYSIWYG editor into a Symfony2 project.

2692.9M24](/packages/stfalcon-tinymce-bundle)[dmishh/settings-bundle

Database centric Symfony configuration management. Global and per-user settings supported.

115254.9k1](/packages/dmishh-settings-bundle)[data-dog/pager-bundle

Paginator bundle for symfony2 and doctrine orm, allows customization with filters and sorters

11103.5k7](/packages/data-dog-pager-bundle)

PHPackages © 2026

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