The simple pagination
Switch branches/tags
Nothing to show
Clone or download
sapogov.n
Latest commit c9d08bf Jan 26, 2016
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
source
.gitignore Updated .gitignore Aug 31, 2014
.php_cs
.travis.yml
CHANGELOG.md
CONTRIBUTING.md
LICENSE
README.md
composer.json
phpunit.xml.dist Moved sources to the `source` directory. Other small changes. Aug 31, 2014

README.md

Pagination

The simple pagination

Downloads License

Requirements

  • PHP >= 5.3.3

Usage

use Kilte\Pagination\Pagination;
$pagination = new Pagination($totalItems, $currentPage, $itemsPerPage, $neighbours);
$offset = $pagination->offset();
$limit = $pagination->limit();
$listing = $someInstance->listing($offset, $limit);
$pages = $pagination->build(); // Contains associative array with a numbers of a pages
// For example:
/*
    array(
        1 => 'first',
        5 => 'less',
        6 => 'previous', // This interval
        7 => 'previous', // is defined
        8 => 'previous', // by
        9 => 'previous', // $neighbours argument
        10 => 'current', // Current page
        11 => 'next',
        12 => 'next',
        13 => 'next',
        14 => 'next',
        15 => 'more',
        20 => 'last'
    )
*/

Note: Tags (like first, current, ...) are defined as constants in the Pagination class (TAG_FIRST, TAG_CURRENT, ...).

Tests

$ composer install
$ vendor/bin/phpunit

Contributing

Contribution process

CHANGELOG

Changelog

LICENSE

The MIT License (MIT)