Download the PHP package tmsolution/knp-paginator-bundle without Composer
On this page you can find all versions of the php package tmsolution/knp-paginator-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tmsolution/knp-paginator-bundle
More information about tmsolution/knp-paginator-bundle
Files in tmsolution/knp-paginator-bundle
Package knp-paginator-bundle
Short Description Paginator bundle for Symfony2 to automate pagination and simplify sorting and other features
License MIT
Homepage http://github.com/KnpLabs/KnpPaginatorBundle
Informations about the package knp-paginator-bundle
Intro to KnpPaginatorBundle
SEO friendly Symfony2 paginator to paginate everything
Generally this bundle is based on Knp Pager component. This component introduces a different way for pagination handling. You can read more about the internal logic on the given documentation link.
Note: Keep knp-components in sync with this bundle. If you want to use older version of KnpPaginatorBundle - use v1.0 tag in the repository which is suitable to paginate ODM mongodb and ORM 2.0 queries
Latest updates
For notes about latest changes please read CHANGELOG
,
for required changes in your code please read UPGRADE
chapter of documentation.
Requirements:
- Knp pager component
>=1.1
- KnpPaginatorBundle's master compatible with symfony (
>=2.0
versions). - Twig
>=1.5
version is required if you use twig templating engine
Features:
- Does not require initializing specific adapters
- Can be customized in any way needed, etc.: pagination view, event subscribers.
- Possibility to add custom filtering, sorting functionality depending on request parameters.
- Separation of concerns, paginator is responsible for generating the pagination view only, pagination view - for representation purposes.
Note: using multiple paginators requires setting the alias in order to keep non conflicting parameters. Also it gets quite complicated with a twig template, since hash arrays cannot use variables as keys.
More detailed documentation:
- Creating custom pagination subscribers
- Extending pagination class (todo, may require some refactoring)
- Customizing view templates and arguments
Installation and configuration:
Pretty simple with Composer, run:
Add PaginatorBundle to your application kernel
Configuration example
You can configure default query parameter names and templates
There are a few additional pagination templates, that could be used out of the box in knp_paginator.template.pagination
key:
KnpPaginatorBundle:Pagination:sliding.html.twig
(by default)KnpPaginatorBundle:Pagination:twitter_bootstrap_v3_pagination.html.twig
KnpPaginatorBundle:Pagination:twitter_bootstrap_pagination.html.twig
KnpPaginatorBundle:Pagination:foundation_v5_pagination.html.twig
Usage examples:
Controller
Currently paginator can paginate:
array
Doctrine\ORM\Query
Doctrine\ORM\QueryBuilder
Doctrine\ODM\MongoDB\Query\Query
Doctrine\ODM\MongoDB\Query\Builder
Doctrine\ODM\PHPCR\Query\Query
Doctrine\ODM\PHPCR\Query\Builder\QueryBuilder
Doctrine\Common\Collection\ArrayCollection
- any doctrine relation collection includingModelCriteria
- Propel ORM query- array with
Solarium_Client
andSolarium_Query_Select
as elements
View
Translation in view
For translating the following text:
- with translation key . The translation is in the domain .
- with translation key . The translation is in the domain .
translationCount and translationParameters can be combined.
Dependency Injection
You can automatically inject a paginator service into another service by using the DIC tag. The tag takes one optional argument , which is the ID of the paginator service that should be injected. It defaults to .
The class that receives the KnpPaginator service must implement . If you're too lazy you can also just extend the base class.
XML configuration example
All versions of knp-paginator-bundle with dependencies
symfony/framework-bundle Version ~2.7|~3.0
knplabs/knp-components Version ~1.2
twig/twig Version ~1.12|~2