PHPackages                             php-pagination/php-pagination - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. php-pagination/php-pagination

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

php-pagination/php-pagination
=============================

PHP Pagination Class with 4 types: Simple Pagination, Google Pagination, Digg/PHPBB Pagination Style.

2.0.1(8y ago)811.9k↓50%1BSD-3-ClausePHPPHP &gt;=7.0

Since Jun 23Pushed 8y ago1 watchersCompare

[ Source](https://github.com/rafapaulino/PHP-Pagination)[ Packagist](https://packagist.org/packages/php-pagination/php-pagination)[ RSS](/packages/php-pagination-php-pagination/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

PHP Pagination
==============

[](#php-pagination)

PHP paging class with 4 different page types:

- `Simple Pagination:` Creates a simple pagination similar to Google. [![simple](https://raw.githubusercontent.com/rafapaulino/PHP-Pagination/master/doc/simple.png)](https://raw.githubusercontent.com/rafapaulino/PHP-Pagination/master/doc/simple.png)
- `PHPBB/Digg Pagination:` Paging in the same style as the PHPBB CMS/Digg. In addition to the normal pages you have the markers with the last pages and home pages. [![phpbb](https://raw.githubusercontent.com/rafapaulino/PHP-Pagination/master/doc/phpbb.png)](https://raw.githubusercontent.com/rafapaulino/PHP-Pagination/master/doc/phpbb.png)
- `Jumping Pagination:` Paging where the markers "jump" after a certain value, for example: Every 10 page markers are displayed from 1 to 10 - 11 to 20 - 21 to 30 and so on. [![jumping](https://raw.githubusercontent.com/rafapaulino/PHP-Pagination/master/doc/jumping.png)](https://raw.githubusercontent.com/rafapaulino/PHP-Pagination/master/doc/jumping.png)
- `Google Pagination:` PHP paging is the same as that used by Google to display search results. [![google](https://raw.githubusercontent.com/rafapaulino/PHP-Pagination/master/doc/google.png)](https://raw.githubusercontent.com/rafapaulino/PHP-Pagination/master/doc/google.png)

See the examples folder for using the class easily.

[![Latest Stable Version](https://camo.githubusercontent.com/a08eaf3e58efd5fc1b36dc104ab7095f3e837feeecb488b307feeb9b87c8ad89/68747470733a2f2f706f7365722e707567782e6f72672f7068702d706167696e6174696f6e2f7068702d706167696e6174696f6e2f762f737461626c65)](https://packagist.org/packages/php-pagination/php-pagination)[![Total Downloads](https://camo.githubusercontent.com/d6abf459e2f02eb742e721953751d06dad440a3a78734fde46f4122719720c20/68747470733a2f2f706f7365722e707567782e6f72672f7068702d706167696e6174696f6e2f7068702d706167696e6174696f6e2f646f776e6c6f616473)](https://packagist.org/packages/php-pagination/php-pagination)[![Latest Unstable Version](https://camo.githubusercontent.com/c2181420e252ca9b929f2ef55e4ed8611dfa6d74bd5273fd9da13f8d8bc5cdd4/68747470733a2f2f706f7365722e707567782e6f72672f7068702d706167696e6174696f6e2f7068702d706167696e6174696f6e2f762f756e737461626c65)](https://packagist.org/packages/php-pagination/php-pagination)[![Monthly Downloads](https://camo.githubusercontent.com/560dcf70b747c2cc29c76364a06cd0ba5660fbd1532f841b75736a4d5466b018/68747470733a2f2f706f7365722e707567782e6f72672f7068702d706167696e6174696f6e2f7068702d706167696e6174696f6e2f642f6d6f6e74686c79)](https://packagist.org/packages/php-pagination/php-pagination)

[![Donate](https://camo.githubusercontent.com/604e3db9c8751116b3f765aad0353ec7ded655bbe8aaacbc38d8c4a6b784b3ed/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f446f6e6174652d50617950616c2d677265656e2e737667)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=SN4SZRSL5HPZU)

Features
--------

[](#features)

- `v2.0.1` Added method to get start for sql clauses.
- `v2.0.0` The methods were refactored, unit tests added, examples and design patters.

### Important informations

[](#important-informations)

- You need PHP 7.0 or higher to use this class.
- I used the strategy pattern to create different pagination types. I put the examples in the examples folder. This pagination returns only one PHP ArrayObject, so you create the layout part as you wish.
- The pagination always returns the first page, last page, previous, next, an ArrayObject with total pages, 2 methods to advance or retreat a deternated number of pages and finally another ArrayObject with the markers following the paging style logic chosen.
- This is a free project, feel free to use it in your projects, even if they are commercial. You can also contribute tips, new features and fixes.

---

Example of use
--------------

[](#example-of-use)

To use this class you must follow the code below. Do not forget to access the [examples folder here in the repository](https://github.com/rafapaulino/PHP-Pagination/tree/master/examples) with the usage examples for each page type. Also access [rafaacademy.com](http://rafaacademy.com/) for tips and tutorials on php and use of this class.

Install: composer require php-pagination/php-pagination

```
