Skip to content

anekdotes/pagination

Repository files navigation

Anekdotes Pagination

Latest Stable Version Build Status StyleCI License Total Downloads Codacy Badge

Utility to generate an intelligent "range" of links based on the current page and total pages.

Installation

Install via composer into your project:

composer require anekdotes/pagination

Basic Usage

Instantiate the class and use the pager method with a few parameters.

  • $pages: total number of pages

  • $current: current page

  • $length (optional): how many page to display

use Anekdotes\Pagination\Pagination;

$pagination = new Pagination();
var_dump($pagination->pager(10, 1));
/*
array(6) {
  [0]=>
  int(1)
  [1]=>
  int(2)
  [2]=>
  int(3)
  [3]=>
  int(4)
  [4]=>
  int(5)
  [5]=>
  int(6)
}
*/

About

Utility to generate an intelligent "range" of links based on the current page and total pages.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages