Download the PHP package metaship-ru/knp-paginator-bundle without Composer
On this page you can find all versions of the php package metaship-ru/knp-paginator-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download metaship-ru/knp-paginator-bundle
More information about metaship-ru/knp-paginator-bundle
Files in metaship-ru/knp-paginator-bundle
Package knp-paginator-bundle
Short Description Paginator bundle for Symfony 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 Symfony 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.7
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.
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
Additional pagination templates
That could be used out of the box in knp_paginator.template.pagination
key:
@KnpPaginator/Pagination/sliding.html.twig
(by default)@KnpPaginator/Pagination/twitter_bootstrap_v4_pagination.html.twig
@KnpPaginator/Pagination/twitter_bootstrap_v3_pagination.html.twig
@KnpPaginator/Pagination/twitter_bootstrap_pagination.html.twig
@KnpPaginator/Pagination/foundation_v5_pagination.html.twig
@KnpPaginator/Pagination/bulma_pagination.html.twig
@KnpPaginator/Pagination/semantic_ui_pagination.html.twig
@KnpPaginator/Pagination/materialize_pagination.html.twig
Additional sortable templates
That could be used out of the box in knp_paginator.template.sortable
key:
@KnpPaginator/Pagination/sortable_link.html.twig
(by default)@KnpPaginator/Pagination/twitter_bootstrap_v3_sortable_link.html.twig
@KnpPaginator/Pagination/font_awesome_sortable_link.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.
Lazy service
The knp_paginator
service will be created lazily if the package ocramius/proxy-manager
is installed.
For more information about lazy services, consult the Symfony documentation on dependency injection.
XML configuration example
Troubleshooting
-
Make sure the translator is activated in your symfony config:
- If your locale is not available, create your own translation file in
app/Resources/translations/KnpPaginatorBundle.en.yml
(substitute en for your own language code if needed) . Then add these lines:
Maintainers
All versions of knp-paginator-bundle with dependencies
knplabs/knp-components Version ^1.3 || 2.3.4.*
symfony/framework-bundle Version ^3.4 || ^4.0
symfony/translation Version ^3.4 || ^4.0
twig/twig Version ^2.0