https://github.com/euskadi31/paginatorserviceprovider
Paginator service provider for Silex
https://github.com/euskadi31/paginatorserviceprovider
Last synced: 2 months ago
JSON representation
Paginator service provider for Silex
- Host: GitHub
- URL: https://github.com/euskadi31/paginatorserviceprovider
- Owner: euskadi31
- License: mit
- Created: 2013-06-22T13:51:37.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2014-02-10T10:24:59.000Z (over 11 years ago)
- Last Synced: 2025-04-09T20:04:51.863Z (2 months ago)
- Language: PHP
- Size: 216 KB
- Stars: 6
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
PaginatorServiceProvider
========================Paginator service provider for Silex
Example
-------```php
register(new Silex\Provider\UrlGeneratorServiceProvider());
$app->register(new Silex\Provider\TwigServiceProvider(), array(
'twig.path' => __DIR__,
'twig.options' => array(
'auto_reload' => true,
'cache' => __DIR__ . '/cache'
)
));
$app->register(new Paginator\Provider\PaginatorServiceProvider());$app->get('/blog/{page}', function($page) use ($app) {
$count = 150; // number of items
$paginator = new Paginator\Paginator($count, 20, $page); //total items, items per page, current page
return $app['twig']->render('test.html.twig', array(
'paginator' => $paginator
));
})->assert('page', '\d+');$app->run();
```twig: test.html.twig
```html
{{ paginator(paginator) }}
```Install
-------Using composer installer and autoloader is probably the easiest way to install Paginator and get it running.
What you need is just a composer.json file in the root directory of your project:
```json
{
"require": {
"euskadi31/paginator-service-provider": "dev-master"
}
}
```