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

ActiveSymfony-bundle

nadialabs/paginator-bundle
==========================

Yet another Paginator bundle

v1.0.24(5y ago)23.0kMITPHPCI failing

Since Nov 18Pushed 5y ago1 watchersCompare

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

READMEChangelogDependencies (12)Versions (26)Used By (0)

NadiaPaginatorBundle
====================

[](#nadiapaginatorbundle)

NadiaPaginatorBundle can help you build pagination UI quickly. You can design your filter and search UI with Symfony Form component, and easily validate input parameters with Form.

[![Example Image](Resources/examples/example.png)](Resources/examples/example.png)

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

[](#installation)

Install with composer , run:

```
composer require nadialabs/paginator-bundle
```

Register Bundle to AppKernel
----------------------------

[](#register-bundle-to-appkernel)

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

Bundle Configuration
--------------------

[](#bundle-configuration)

```
nadia_paginator:
    default_options:
        input_key_class: Nadia\Bundle\PaginatorBundle\Input\InputKeys
        default_page_size: 10
        default_page_range: 8
        session_enabled: false
        default_translation_domain: null
    templates:
        pages: '@NadiaPaginator/templates/bootstrap4/pages.html.twig'
        searches: '@NadiaPaginator/templates/bootstrap4/searches.html.twig'
        filters: '@NadiaPaginator/templates/bootstrap4/filters.html.twig'
        sorts: '@NadiaPaginator/templates/bootstrap4/sorts.html.twig'
        sort_link: '@NadiaPaginator/templates/bootstrap4/sort_link.html.twig'
        page_sizes: '@NadiaPaginator/templates/bootstrap4/page_sizes.html.twig'
```

- default\_options
    - input\_key\_class: The class that define the http request parameter keys.
    - default\_page\_size: Default page size
    - default\_page\_range: Default page range (control page link amounts)
    - session\_enabled: Enable session support, store input data in session. You can use a clean URL without query string when enabled it. Otherwise the filter, search, sort, page size, and page parameters will be part of URL query string, or transfer by POST request body.
    - default\_translation\_domain: Default [`translation-domain`](https://symfony.com/doc/3.4/reference/forms/types/form.html#translation-domain) value for each Form.
- templates
    - pages: Template for rendering pages
    - searches: Template for rendering searches block
    - filters: Template for rendering filters block
    - sorts: Template for rendering sort selection block
    - sort\_link: Template for rendering sort link
    - page\_sizes: Template for rendering page size selection block

Create PaginatorType class
--------------------------

[](#create-paginatortype-class)

Define a Paginator configuration.

Example class: [`AppBundle\Paginator\Movies\PaginatorType`](Resources/examples/AppBundle/Paginator/Movies/PaginatorType.php)

You can implement these methods to define a PaginatorType class:

#### `buildSearch`

[](#buildsearch)

Use [`SearchBuilder`](Configuration/SearchBuilder.php) to setup search form elements with Symfony FormType styles.

#### `buildFilter`

[](#buildfilter)

Use [`FilterBuilder`](Configuration/FilterBuilder.php) to setup filter form elements with Symfony FormType styles.

#### `buildSort`

[](#buildsort)

Use [`SortBuilder`](Configuration/SortBuilder.php) to setup sorting methods.

#### `buildPageSize`

[](#buildpagesize)

Use [`PageSizeBuilder`](Configuration/PageSizeBuilder.php) to setup page size list.

#### `getFormOptions`

[](#getformoptions)

Setup the paginator form options, return an array contain form options.

#### `configureOptions`

[](#configureoptions)

Setup the paginator options, you can define custom options to injecting extra data into PaginatorType. PaginatorType will use this options in these methods: `buildSearch` `buildFilter` `buildSort` `buildPageSize` `getFormOptions`.

### Create SearchQueryCompiler class

[](#create-searchquerycompiler-class)

Define a QueryCompiler to build custom search criteria.

Example class for Doctrine QueryBuilder: [`AppBundle\Paginator\Movies\FilterQueryCompiler`](Resources/examples/AppBundle/Paginator/Movies/SearchQueryCompiler.php)

### Create FilterQueryCompiler class

[](#create-filterquerycompiler-class)

Define a QueryCompiler to build custom filter criteria.

Example class for Doctrine QueryBuilder: [`AppBundle\Paginator\Movies\FilterQueryCompiler`](Resources/examples/AppBundle/Paginator/Movies/FilterQueryCompiler.php)

Create Pagination instance with PaginatorType
---------------------------------------------

[](#create-pagination-instance-with-paginatortype)

Example controller: [`MovieController`](Resources/examples/AppBundle/Controller/MovieController.php)
Example entities: [`Movie`](Resources/examples/AppBundle/Entity/Movie.php), [`People`](Resources/examples/AppBundle/Entity/People.php)

To get a Pagination instance, the process as below:

1. Use [`PaginatorTypeContainer`](DependencyInjection/Container/PaginatorTypeContainer.php) to generate a PaginatorType instance.
2. Use [`PaginatorFactory`](Factory/PaginatorFactory.php) to generate a Paginator instance with a PaginatorType instance.
3. Create a query instance (in this example is a Doctrine ORM QueryBuilder instance)
4. Do paginate with Paginator, and get a Pagination instance
5. Render a view with Pagination instance

```
// Example controller action

$options = [
    'movieCompanies' => [
        'Warner Bros.',
        'Sony Pictures',
        'Walt Disney',
        'Universal Pictures',
        '20th Century Fox',
        'Paramount Pictures',
        'Lionsgate Films',
        'The Weinstein Company',
        'DreamWorks Pictures',
    ],
];
$paginator = $this->get('nadia_paginator.paginator_factory')->create(PaginatorType::class, $options);

$qb = $this->getDoctrine()->getRepository(Movie::class)
    ->createQueryBuilder('movie')
    ->select(['movie', 'director'])
    ->leftJoin('movie.director', 'director')
;
/** @var Movie[]|Collection|Pagination $pagination */
$pagination = $paginator->paginate($qb);
```

Rendering HTML with Twig
------------------------

[](#rendering-html-with-twig)

You can easily render a list page with this template [`@NadiaPaginator/templates/bootstrap4/pagination.html.twig`](Resources/views/templates/bootstrap4/pagination.html.twig)
Use twig [`embed`](https://twig.symfony.com/doc/2.x/tags/embed.html) tag to overwrite `tableContent` block and put your table contents in `tableContent` block.

Example twig file: [`index.html.twig`](Resources/examples/AppBundle/Resources/views/Movie/index.html.twig)

```
// Render view
$this->render('@App/Movie/index.html.twig', ['pagination' => $pagination]);
```

```
{# Example view file #}

{% use '@NadiaPaginator/templates/bootstrap4/pagination.html.twig' %}

    {{ block('pagination') }}

{% block tableContent %}

                {{ nadia_paginator_sort_link(pagination, 'title', 'movie.title', 'ASC') }}

                {{ nadia_paginator_sort_link(pagination, 'description', 'movie.description', 'ASC') }}

                {{ nadia_paginator_sort_link(pagination, 'releasedAt', 'movie.releasedAt', 'DESC') }}

            Director
            Company

        {% for movie in pagination %}

                {{ movie.title }}
                {{ movie.description }}
                {{ movie.releasedAt|date('Y-m-d') }}
                {{ movie.director.name }}
                {{ movie.company }}

        {% endfor %}

{% endblock tableContent %}
```

### Rendering searches block in Twig

[](#rendering-searches-block-in-twig)

Use `nadia_paginator_searches` method to render search block in Twig template.

```
{{ nadia_paginator_searches(pagination, {attributes: {class: 'col-md-6 col-xl-4 search'}}) }}
```

### Rendering filters block in Twig

[](#rendering-filters-block-in-twig)

Use `nadia_paginator_filters` method to render filter block in Twig template.

```
{{ nadia_paginator_filters(pagination, {attributes: {class: 'col-md-4 col-xl-3 mb-1 filter'}}) }}
```

### Rendering sorts block in Twig

[](#rendering-sorts-block-in-twig)

Use `nadia_paginator_sorts` method to render sorting block in Twig template.

```
{{ nadia_paginator_sorts(pagination) }}
```

### Rendering page sizes block in Twig

[](#rendering-page-sizes-block-in-twig)

Use `nadia_paginator_page_sizes` method to render page sizes block in Twig template.

```
{{ nadia_paginator_page_sizes(pagination) }}
```

### Rendering sort link in Twig

[](#rendering-sort-link-in-twig)

```
{{ nadia_paginator_sort_link(pagination, 'title', 'movie.title', 'ASC') }}
```

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity71

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

Recently: every ~19 days

Total

25

Last Release

2041d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4eb44e923e5c3b94cf89c526b93e564940825db07ab3bdb96125bac840ce80f5?d=identicon)[leoontheearth](/maintainers/leoontheearth)

---

Top Contributors

[![LeoOnTheEarth](https://avatars.githubusercontent.com/u/726108?v=4)](https://github.com/LeoOnTheEarth "LeoOnTheEarth (101 commits)")

---

Tags

symfonybundlepaginatorpaginationnadianadialabs

### Embed Badge

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

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

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M650](/packages/sylius-sylius)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[contao/core-bundle

Contao Open Source CMS

1231.6M2.3k](/packages/contao-core-bundle)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)

PHPackages © 2026

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