https://github.com/facile-it/paginator-bundle
Symfony2 Paginator Bundle
https://github.com/facile-it/paginator-bundle
pagination-bundle paginator php symfony2-pagination
Last synced: 3 months ago
JSON representation
Symfony2 Paginator Bundle
- Host: GitHub
- URL: https://github.com/facile-it/paginator-bundle
- Owner: facile-it
- License: apache-2.0
- Created: 2014-08-26T13:42:53.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2023-06-04T08:45:46.000Z (over 2 years ago)
- Last Synced: 2025-05-30T22:37:05.059Z (4 months ago)
- Topics: pagination-bundle, paginator, php, symfony2-pagination
- Language: PHP
- Size: 42 KB
- Stars: 4
- Watchers: 44
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
A **lightweight** symfony2 pagination system
[](https://travis-ci.org/facile-it/paginator-bundle)
[](https://codeclimate.com/github/facile-it/paginator-bundle)## Requirements:
- Twig`>=1.5` version is required if you plan to include the twig template.
- Twig `2.*` is allowed## Features:
- Inizialization can be made via request or via setters
- Handle route as well as route parameters## Installation and configuration:
Quite easy [Composer](http://packagist.org), add:
```json
{
"require": {
"facile-it/paginator-bundle": "dev-master"
}
}
```Or if you want to clone the repos:
git clone git://github.com/facile-it/paginator-bundle.git vendor/facile-it/PaginatorBundle
### Add PaginatorBundle to your application kernel
```php
// app/AppKernel.php
public function registerBundles()
{
return array(
// ...
new Facile\PaginatorBundle\FacilePaginatorBundle(),
// ...
);
}
```## Usage examples:
### Controller
Currently paginator can paginate:
- `Doctrine\ORM\QueryBuilder`
```php
// Acme\MainBundle\Controller\ProductController.php$queryBuilder = $this
->get('doctrine.orm.entity_manager')
->getRepository('AcmeMainBundle:Product')
->createQueryBuilder('product')$paginator = $this->get('facile.paginator')->parseRequest($this->getRequest());
return $this->render('AcmeMainBundle:Product:list.html.twig', array(
'results' => $pagination,
'paginationInfo' => $paginator->getPaginationInfo($filterBuilder
)
);```
### View
```jinja
{# display results #}
{% for product in results %}
{{ product.id }}
{{ product.title }}
{% endfor %}{# display navigation #}
```