anekdotes/pagination

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

2.0.0 2021-11-24 18:23 UTC

This package is auto-updated.

Last update: 2024-12-25 01:07:52 UTC


README

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)
}
*/