PHP Classes

PHP Pagination Links: Display links to browse pages of entry listings

Recommend this page to a friend!
  Info   View files Example   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 185 All time: 8,562 This week: 292Up
Version License PHP version Categories
pagination-links 1.0.0MIT/X Consortium ...5HTML, Databases
Description Author

This class can display links to browse pages of entry listings.

It can take as parameter the total number of entries in a listing, the limit number of entries to display per page and the number of the current listing page.

The class can generate links to browse to the other pages of the listings.

The format of the link URLs, show the first and last links, show links a page numbers are configurable options.

Picture of Miraz Mac
  Performance   Level  
Name: Miraz Mac <contact>
Classes: 13 packages by
Country: Bangladesh Bangladesh
Age: 27
All time rank: 207131 in Bangladesh Bangladesh
Week rank: 161 Up9 in Bangladesh Bangladesh Up
Innovation award
Innovation award
Nominee: 5x



Yet another PHP class to generate pagination links in PHP.

Looking for a quick way to generate pagination links? Say no more! Though the code is well commented and there is a full example inside examples directory I would still write some basic documentation here.

Install via Composer <3

composer require mirazmac/pagination-links

PaginationLinks Options

Pagination links has these options to control its appearance/behavior.

$OPTIONS = array(
	 * The base URL
	 * %_PAGE% - Prints the page number
	 * %_QUERY% - Appends the current GET Query
	'url' => '?page=%_PAGE%&foo=bar%_QUERY%',

	/ Toggle the `First & Last` Links */
	'show_extra' => true,

	/ Toggle numeric pagination ( 1 2 3 4...8 ) */
	'show_numeric' => true,

	 * The GET key to skip from appending in %_QUERY%
	 * append_get_queries must be set to true if you want to use this
	'get_key_to_skip' => array('foo', 'cool', 'bar'),

Getting Started

To use PaginationLinks you must include it it your project.

require_once 'src/PaginationLinks.php';
use mirazmac\PaginationLinks;
$pagination = New PaginationLinks();
// Optionally, You can pass an array of options in constructor
$pagination = New PaginationLinks($OPTIONS);

Build the Pages

This is a MUST do to build the pages after constructing the class. Just like this:

 * Build the Pagination links
 * @param  integer  $total        Number of total items
 * @param  integer  $current_page Number of current page
 * @param  integer $per_page     Number of Items per page (defaults to 10)
 * @return boolean               Returns always true.
$pagination->buildPages($total, $current_page, $per_page);

Show the PaginationLinks

After building the pages, you can show it just like this ( I ain't gonna say this anymore -_- )

// Voila!!
echo $pagination->getPages();

No more docs!

Please read the code, explore the example! Sorry for my bad English -_-

  Files folder image Files  
File Role Description
Files folder imageexamples (1 file)
Files folder imagesrc (1 file)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file Doc. Documentation

  Files folder image Files  /  examples  
File Role Description
  Accessible without login Plain text file PDOExample.php Example Example script

  Files folder image Files  /  src  
File Role Description
  Plain text file PaginationLinks.php Class Class source

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:8,562
This week:292Up
For more information send a message to info at phpclasses dot org.