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

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

anime-db/pagination-bundle
==========================

Pagination bundle

v1.0.3(9y ago)171MITPHPPHP &gt;=5.5.0

Since Mar 31Pushed 9y ago1 watchersCompare

[ Source](https://github.com/anime-db/pagination-bundle)[ Packagist](https://packagist.org/packages/anime-db/pagination-bundle)[ Docs](http://github.com/anime-db/pagination-bundle)[ RSS](/packages/anime-db-pagination-bundle/feed)WikiDiscussions master Synced 5d ago

READMEChangelog (1)Dependencies (7)Versions (5)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/d9d456acddfb824664ec1097cbd58096b35df96a82b072de36ae426388a89890/68747470733a2f2f706f7365722e707567782e6f72672f616e696d652d64622f706167696e6174696f6e2d62756e646c652f762f737461626c652e706e67)](https://packagist.org/packages/anime-db/pagination-bundle)[![Latest Unstable Version](https://camo.githubusercontent.com/6712b0c987cebfa387d658fe86edf36e599d7c784623e76696f34030a7bd52dd/68747470733a2f2f706f7365722e707567782e6f72672f616e696d652d64622f706167696e6174696f6e2d62756e646c652f762f756e737461626c652e706e67)](https://packagist.org/packages/anime-db/pagination-bundle)[![Total Downloads](https://camo.githubusercontent.com/527cf515af2b867efe230840a4ac6cc1f5991d91876b930280460821e97346bb/68747470733a2f2f706f7365722e707567782e6f72672f616e696d652d64622f706167696e6174696f6e2d62756e646c652f646f776e6c6f616473)](https://packagist.org/packages/anime-db/pagination-bundle)[![Build Status](https://camo.githubusercontent.com/425878d587f608bed4145daee834ddcc1722a0bee44573d3ee70944a8e4a10d2/68747470733a2f2f7472617669732d63692e6f72672f616e696d652d64622f706167696e6174696f6e2d62756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/anime-db/pagination-bundle)[![Coverage Status](https://camo.githubusercontent.com/4f574fc612308addbf9d88fa7cba582f010d7a0908f1617e75054f28e09eb7a8/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f616e696d652d64622f706167696e6174696f6e2d62756e646c652f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/anime-db/pagination-bundle?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/eeb75950ef94f9e54b9f3284006767bc4b7ab00225d6a53820f1744052647f19/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f616e696d652d64622f706167696e6174696f6e2d62756e646c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/anime-db/pagination-bundle/?branch=master)[![SensioLabsInsight](https://camo.githubusercontent.com/3d98432bd01a313992b2b2c59c12915ec71d8af03d20f935e3c04f08f60a7830/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f34376432396631622d383330642d346331312d616161342d3031303331663233613865612f6d696e692e706e67)](https://insight.sensiolabs.com/projects/47d29f1b-830d-4c11-aaa4-01031f23a8ea)[![StyleCI](https://camo.githubusercontent.com/4fc83f3f0c9a4caf5d0d1801b56eedd002aa4731dbbd2158d6addb43ebcd9a0f/68747470733a2f2f7374796c6563692e696f2f7265706f732f35353133383337302f736869656c64)](https://styleci.io/repos/55138370)[![License](https://camo.githubusercontent.com/16494c3e7a86d055a8e4c98d7eb102bd57840c088f95a021416d901202b9fdea/68747470733a2f2f706f7365722e707567782e6f72672f616e696d652d64622f706167696e6174696f6e2d62756e646c652f6c6963656e73652e706e67)](https://packagist.org/packages/anime-db/pagination-bundle)

PaginationBundle
================

[](#paginationbundle)

This repository is for AnimeDbPaginationBundle. GpsLabPaginationBundle, the new version of PaginationBundle, has been released and is available at .

AnimeDbPaginationBundle is no longer maintained and is now end of life.

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

[](#installation)

Pretty simple with [Composer](http://packagist.org), run:

```
composer require anime-db/pagination-bundle
```

Add PaginatorBundle to your application kernel

```
// app/AppKernel.php
public function registerBundles()
{
    return array(
        // ...
        new AnimeDb\Bundle\PaginationBundle\AnimeDbPaginationBundle(),
        // ...
    );
}
```

### Configuration example

[](#configuration-example)

You can configure default templates

```
anime_db_pagination:
    max_navigate: 5 # default page range used in pagination control
    template: 'AnimeDbPaginationBundle::pagination.html.twig' # sliding pagination controls template
```

Usage
-----

[](#usage)

```
namespace Acme\DemoBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Sensio\Bundle\FrameworkExtraBundle\Configuration;

class ArticleController extends Controller
{
    /**
     * @Configuration\Route("/article/", name="article_index")
     * @Configuration\Method({"GET"})
     *
     * @param Request $request
     *
     * @return Response
     */
    public function indexAction(Request $request)
    {
        $per_page = 100; // articles per page
        $em = $this->get('doctrine.orm.entity_manager');
        $router = $this->get('router');

        // get total articles
        $total = (int)$em
            ->createQueryBuilder()
            ->select('COUNT(*)')
            ->from('AcmeDemoBundle:Article', 'a')
            ->getQuery()
            ->getSingleScalarResult();

        // build pagination
        $pagination = $this
            ->get('pagination')
            ->paginate(
                ceil($total / $per_page), // total pages
                $request->query->get('page') // correct page
            )
            ->setPageLink(function($page) use ($router) { // build page link
                return $router->generate('article_index', ['page' => $page]);
            })
            ->setFirstPageLink($router->generate('article_index')); // build link for first page

        // get articles chunk
        $articles = $em
            ->createQueryBuilder()
            ->select('*')
            ->from('AcmeDemoBundle:Article', 'a')
            ->setFirstResult(($pagination->getCurrentPage() - 1) * $per_page)
            ->setMaxResults($per_page)
            ->getQuery()
            ->getResult();

        // template parameters
        return $this->render('AcmeDemoBundle:Article:index.html.twig', [
            'total' => $total,
            'articles' => $articles,
            'pagination' => $pagination
        ]);
    }
}
```

### From QueryBuilder

[](#from-querybuilder)

```
namespace Acme\DemoBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Sensio\Bundle\FrameworkExtraBundle\Configuration;
use Acme\DemoBundle\Entity\Article;

class ArticleController extends Controller
{
    /**
     * @var int
     */
    const PER_PAGE = 100;

    /**
     * @Configuration\Route("/article/", name="article_index")
     * @Configuration\Method({"GET"})
     *
     * @param Request $request
     *
     * @return Response
     */
    public function indexAction(Request $request)
    {
        // create get articles query
        // would be better move this query to repository class
        $query = $this
            ->getDoctrine()
            ->getRepository('AcmeDemoBundle:Article')
            ->createQueryBuilder('a')
            ->where('a.status = :status')
            ->setParameter('status', Article::STATUS_ENABLED);

        // build pagination
        $pagination = $this
            ->get('pagination')
            ->paginateQuery(
                $query, // query
                self::PER_PAGE, // articles per page
                $request->query->get('page') // correct page
            )
            ->setPageLink(function($page) { // build page link
                return $this->generateUrl('article_index', ['page' => $page]);
            })
            ->setFirstPageLink($this->generateUrl('article_index')); // build link for first page

        // template parameters
        return $this->render('AcmeDemoBundle:Article:index.html.twig', [
            'total' => $pagination->getTotalPages(), // total pages
            'articles' => $query->getQuery()->getResult(), // get articles chunk
            'pagination' => $pagination
        ]);
    }
}
```

### View

[](#view)

```
{# total items #}

    {{ total }}

{# list articles #}

    {% for article in articles %}

            {{ article.id }}
            {{ article.title }}
            {{ article.date|date('Y-m-d, H:i:s') }}

    {% endfor %}

{# display navigation #}

    {{ pagination_render(pagination) }}

```

### Custom view

[](#custom-view)

```
{# display navigation #}
{{ pagination_render(pagination, 'custom_pagination.html.twig', {custom_var: 'foo'}) }}
```

Example Material Design template for pagination

```
{# custom_pagination.html.twig #}

{# print 'foo' #}
{{ custom_var }}

{% if pagination.total > 1 %}
{% spaceless %}

        {% if pagination.prev %}

                    chevron_left

        {% else %}

                    chevron_left

        {% endif %}
        {% for item in pagination %}
            {% if item.current %}

                    {{ item.page }}

            {% else %}

                    {{ item.page }}

            {% endif %}
        {% endfor %}
        {% if pagination.next %}

                    chevron_right

        {% else %}

                    chevron_right

        {% endif %}

{% endspaceless %}
{% endif %}
```

License
-------

[](#license)

This bundle is under the [MIT license](http://opensource.org/licenses/MIT). See the complete license in the file: LICENSE

###  Health Score

27

—

LowBetter than 46% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

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

Total

4

Last Release

3423d ago

PHP version history (2 changes)v1.0.0PHP &gt;=5.4.0

v1.0.1PHP &gt;=5.5.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/9a6415c83577efe7b70d9ae4a3bb12958adc11c16e530ff844ff217b0fd0c54a?d=identicon)[Peter Gribanov](/maintainers/Peter%20Gribanov)

---

Top Contributors

[![peter-gribanov](https://avatars.githubusercontent.com/u/1954436?v=4)](https://github.com/peter-gribanov "peter-gribanov (84 commits)")

---

Tags

componentpaginationphpphpsymfonydoctrinepagination

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/anime-db-pagination-bundle/health.svg)

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

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k18.3M418](/packages/easycorp-easyadmin-bundle)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

12017.1k](/packages/rcsofttech-audit-trail-bundle)[sulu/sulu

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

1.3k1.4M231](/packages/sulu-sulu)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1617.3k16](/packages/2lenet-crudit-bundle)

PHPackages © 2026

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