2017 © Pedro Peláez
 

library php-paginator

Simple PHP paginator for Symfony2.8+

image

abraovic/php-paginator

Simple PHP paginator for Symfony2.8+

  • Wednesday, October 26, 2016
  • by abraovic
  • Repository
  • 1 Watchers
  • 0 Stars
  • 7 Installations
  • HTML
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

abraovic/php-paginator

Installation

The preferred method of installation is via Packagist and Composer. Run the following command to install the package and add it as a requirement to your project's composer.json:, (*1)

composer require abraovic/php-paginator

How to use

Add new twig template path to app/config/config.yml, (*2)

# Twig Configuration
twig:
    ...
    paths:
        '%kernel.root_dir%/../vendor/abraovic/php-paginator/src/template': 'abraovic_paginate'

In your controller:, (*3)

use abraovic\phpPaginator\Paginate;

class ... {
    function ... {
        return $this->render(
                    'some.html.twig',
                    [
                        ...,
                        'pagination' => Paginate::data(
                            $page, // current page
                            $limit, // max limit per page
                            $total, // total number of items
                            $this->get('router')->generate('_route_name', array(), true) // route link - replace _route_name with proper name
                        )
                    ]
                );
    }
}

In your twig:, (*4)

{{ include('@abraovic_paginate/_paginate.html.twig') }}

If there is a translation bundle installed you can translate First and Last labels by adding the keys in your app's messages.yaml like this:, (*5)

First: [first in some other language]
Last: [last in some other language]

Contributing

Contributions are welcome! Please read CONTRIBUTING for details., (*6)

The abraovic/php-paginator library is copyright © Ante Braovic and licensed for use under the MIT License., (*7)

The Versions

26/10 2016

dev-master

9999999-dev https://github.com/abraovic/php-paginator

Simple PHP paginator for Symfony2.8+

  Sources   Download

Apache-2.0

The Requires

  • php >=5.3

 

php paginate