Download the PHP package ttskch/pagination-service-provider without Composer
On this page you can find all versions of the php package ttskch/pagination-service-provider. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ttskch/pagination-service-provider
More information about ttskch/pagination-service-provider
Files in ttskch/pagination-service-provider
Package pagination-service-provider
Short Description pagination service provider for the Silex microframework.
License MIT
Homepage https://github.com/ttskch/PaginationServiceProvider
Informations about the package pagination-service-provider
PaginationServiceProvider
This service provider allows you to use KnpPaginatorBundle in your Silex application.
Requirements
- 3.x: PHP 5.5.9+
- 1.x: PHP 5.3+
Getting Started
For Silex 2.x
For Silex 1.x
And enable this service provider in your application:
If you need, you can configure default query parameter names and templates as below (almost same as origin):
Then you can create pagination instance and render it in view:
Usage
KnpPaginatorBundle can paginate many things. But in Silex application we may use for:
- Array
- Doctrine\DBALQueryBuilder
However KnpPaginatorBundle doesn't sort or filter these data automatically via request query parameter. If you want to sort or filter these data you should do by hand.
Sort or filter array
When you want to sort or filter simple two-dimensional array, you can use Cake\Utility\Hash (autoloaded) like as below:
See the official document for more information of usage of Hash class.
Sort or filter Doctrine\DBALQueryBuilder
When you use Doctrine\DBALQueryBuilder you can sort or filter by SQL clauses like as below:
Demo
You can see demo code here. You also can run demo easily on your local by following command.
Now you see demo on http://localhost:8888 like below.
Additional features
This service provider also provides bootstrap3-based beautiful pagination and filtration templates. You can use it as below:
When you use the pagination-bootstrap3.html.twig
template, you can configure the list of Items per page
selector.
You also can define translations for some labels in the messages
domain.
Note
This service provider depends on TwigServiceProvider
and TranslationServiceProvider
. Please register them before register PaginationServiceProvider
.
All versions of pagination-service-provider with dependencies
silex/silex Version ~2.0
twig/twig Version ~1.27|~2.0
symfony/twig-bridge Version ~2.8|~3.0
symfony/translation Version ~2.8|~3.0
knplabs/knp-paginator-bundle Version ~2.5
cakephp/utility Version ~3.0