https://github.com/adambinnersley/pagination
Create a HTML pagination element using PHP. Compatible with Bootstrap and easily customisable classes.
https://github.com/adambinnersley/pagination
bootstrap-pager pagination pagination-components php-pagination
Last synced: 4 months ago
JSON representation
Create a HTML pagination element using PHP. Compatible with Bootstrap and easily customisable classes.
- Host: GitHub
- URL: https://github.com/adambinnersley/pagination
- Owner: adambinnersley
- License: mit
- Created: 2017-05-26T09:34:33.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2020-10-23T11:43:24.000Z (over 5 years ago)
- Last Synced: 2025-10-19T18:07:27.147Z (8 months ago)
- Topics: bootstrap-pager, pagination, pagination-components, php-pagination
- Language: PHP
- Homepage:
- Size: 31.3 KB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://api.travis-ci.org/AdamB7586/pagination)
[](https://scrutinizer-ci.com/g/AdamB7586/pagination/)
[](https://scrutinizer-ci.com/g/AdamB7586/pagination/)
[](https://php.net/)
# Pagination
Create a HTML pagination element using PHP. Compatible with Bootstrap and easily customisable classes.
## Installation
Installation is available via [Composer/Packagist](https://packagist.org/packages/adamb/pagination), you can add the following line to your `composer.json` file:
```json
"adamb/pagination": "^1.0"
```
or
```sh
composer require adamb/pagination
```
## License
This software is distributed under the [MIT](https://github.com/AdamB7586/pagination/blob/master/LICENSE) license. Please read LICENSE for information on the
software availability and distribution.
## Features
- Creates a pagination HTML element
- Compatible with Bootstrap 3/4
- Change the class names assigned to the elements
- Easily change maximum number of links show
- If only 1 page exists no pager will be displayed
## Usage
### 1. Creating the pagination HTML
#### PHP Code
```php
paging($numberOfRecords, $pageURL, $currentPage, $resultsPerPage));
```
#### HTML Output
```html
```
### 2. Changing the class names added to the HTML elements
#### PHP Code
```php
setPaginationClass('my_custom_pager')
->setActiveClass('this_is_active');
echo($pagination->paging($numberOfRecords, $pageURL, $currentPage));
```
#### HTML Output
```html
```
###
### 3. Additional features
There are a range of options available to customise for your project, here you can customise things such as the number of items being displayed each page witch will either increase or reduce the number of links. You can also change the maximum number of buttons show, turn off the display of the arrow buttons and also add additions items to the URL query string.
#### PHP Code
```php
'Hello', // urlencode($_GET['search']),
'important_info' => 42, // urlencode($_GET['important_info']),
);
$pagination = new Pagination();
echo($pagination->paging($numberOfRecords, $pageURL, $currentPage, $resultsPerPage, $maximumLinksToDisplay, $displayArrows, $additionalQuery));
```
#### HTML Output
```html
```