2017 © Pedro Peláez
 

library paginator-service-provider

Paginator service provider for Silex

image

euskadi31/paginator-service-provider

Paginator service provider for Silex

  • Monday, February 10, 2014
  • by euskadi31
  • Repository
  • 3 Watchers
  • 6 Stars
  • 6,359 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 1 Versions
  • 3 % Grown

The README.md

PaginatorServiceProvider

Paginator service provider for Silex, (*1)

Example

<?php

namespace App;

use Paginator;
use Silex;

require __DIR__ . '/../vendor/autoload.php';

$app = new Silex\Application();

$app->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, (*2)

{{ 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:, (*3)

{
    "require": {
        "euskadi31/paginator-service-provider": "dev-master"
    }
}

The Versions

10/02 2014

dev-master

9999999-dev https://github.com/euskadi31/PaginatorServiceProvider

Paginator service provider for Silex

  Sources   Download

MIT

The Requires

 

The Development Requires

service silex pagination paginator provider