PHP Classes
elePHPant
Icontem

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

Recommend this page to a friend!
  Info   View files Documentation   View files View files (10)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2015-06-17 (1 year ago) RSS 2.0 feedNot yet rated by the usersTotal: 224 All time: 7,630 This week: 1,042Up
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 <contact>
Classes: 8 packages by
Country: Portugal Portugal
Innovation award
Innovation award
Nominee: 1x

Details

Pagination

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

Lightweight and easy to use pagination library

Install

Via Composer

$ composer require masnathan/pagination

Usage

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.

Testing

$ composer test

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email andre.r.flip@gmail.com instead of using the issue tracker.

Credits

License

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

  Files folder image Files  
File Role Description
Files folder imagesrc (1 file, 1 directory)
Files folder imagetests (1 file)
Accessible without login Plain text file CHANGELOG.md Data Documentation
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file CONTRIBUTING.md Data Documentation
Accessible without login Plain text file LICENSE.md Lic. License text
Accessible without login Plain text file phpunit.xml.dist Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  src  
File Role Description
Files folder imageHtml (2 files)
  Plain text file Pagination.php Class Class source

  Files folder image Files  /  src  /  Html  
File Role Description
  Plain text file Bootstrap.php Class Class source
  Plain text file Pagination.php Class Class source

  Files folder image Files  /  tests  
File Role Description
  Accessible without login Plain text file PaginationTest.php Test Unit test script

 Version Control Unique User Downloads Download Rankings  
 100%
Total:224
This week:0
All time:7,630
This week:1,042Up