MASNathan\Pagination: Get pagination links for listings split in pages

Recommend this page to a friend!
  Info   Documentation   View files (10)   Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 234 All time: 7,942 This week: 389
Version License PHP version Categories
masnathan-pagination 1.0.0MIT/X Consortium ...5.3HTML, PHP 5
Description Author

This package can get pagination links for listings split in pages.

It takes as parameters the total number of entries in a listing, the limit of entries to show per page, and the number of the current page.

The class can generate an array with the list of all pages to be displayed in the pagination listing.

Separate classes can format the pagination listing as HTML with links that the user can click to between the different pages of the listing. A special subclass is dedicated to use Bootstrap CSS styles.

Picture of Andre Roque Filipe
  Performance   Level  
Name: Andre Roque Filipe is available for providing paid consulting. Contact Andre Roque Filipe .
Classes: 9 packages by
Country: Portugal Portugal
Age: 28
All time rank: 124316 in Portugal Portugal
Week rank: 243 5 in Portugal Portugal
Innovation award
Innovation award
Nominee: 2x



Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads Support via Gittip

Lightweight and easy to use pagination library


Via Composer

$ composer require masnathan/pagination


use MASNathan\Pagination\Pagination;

$pager = new Pagination($totalPages, $boundaries, $around, $currentPage);

foreach ($pager->getPages() as $pageLabel) {
    echo sprintf('<a href="/list/page/%s">%s</a>', $pageLabel, $pageLabel);

You can also check the `MASNathan\Pagination\Html\Pagination` for a html builder, it's possible to extend it as well, check the Bootstrap class.

Change log

Please see CHANGELOG for more information what has changed recently.


$ composer test


Please see CONTRIBUTING for details.


If you discover any security related issues, please email instead of using the issue tracker.



The MIT License (MIT). Please see License File for more information.

File Role Description
src (1 file, 1 directory)
tests (1 file) Data Documentation
composer.json Data Auxiliary data Data Documentation Lic. License text
phpunit.xml.dist Data Auxiliary data Doc. Documentation

  Files  /  src  
File Role Description
Html (2 files)
   Pagination.php Class Class source

  Files  /  src  /  Html  
File Role Description
   Bootstrap.php Class Class source
   Pagination.php Class Class source

  Files  /  tests  
File Role Description
   PaginationTest.php Test Unit test script

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:7,942
This week:389

For more information send a message to info at phpclasses dot org.