PHPackages                             germania-kg/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. germania-kg/pagination

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

germania-kg/pagination
======================

Paginate your Traversables

1.0.4(4y ago)017MITPHPPHP ^7.0

Since Mar 14Pushed 3y ago2 watchersCompare

[ Source](https://github.com/GermaniaKG/Pagination)[ Packagist](https://packagist.org/packages/germania-kg/pagination)[ RSS](/packages/germania-kg-pagination/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (4)Versions (7)Used By (0)

Germania KG · Pagination
========================

[](#germania-kg--pagination)

[![Packagist](https://camo.githubusercontent.com/b3851d059aa1b9657742cdc6c87e75d0b884cd7935ac04e676e6a46bd0acbcb0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6765726d616e69612d6b672f706167696e6174696f6e2e7376673f7374796c653d666c6174)](https://packagist.org/packages/germania-kg/pagination)[![PHP version](https://camo.githubusercontent.com/28ae2fa3219625e2b0b055d255b22f622701af8f9d044e13b8ba329213e1394f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6765726d616e69612d6b672f706167696e6174696f6e2e737667)](https://packagist.org/packages/germania-kg/pagination)[![Build Status](https://camo.githubusercontent.com/391447c193b4215ce0a8362e849ec2995e2f40ccdc03d6143f26a25024159a20/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f4765726d616e69614b472f506167696e6174696f6e2e7376673f6c6162656c3d5472617669732532304349)](https://travis-ci.org/GermaniaKG/Pagination)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/63cd81179ed3c47bf282e0d6be36e89de0d378691de56e7cfb1fdd3d343616c6/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4765726d616e69614b472f506167696e6174696f6e2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/GermaniaKG/Pagination/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/6c6ad5ff0ed3d826d0a0324559ab1426fce6137a607dd133685c0fb96eab6f2f/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4765726d616e69614b472f506167696e6174696f6e2f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/GermaniaKG/Pagination/?branch=master)[![Build Status](https://camo.githubusercontent.com/7ed6ac2e3c6ebc62096b4ab9d7710ee7a8d4c6dc7286806c20221df2a1188b55/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4765726d616e69614b472f506167696e6174696f6e2f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/GermaniaKG/Pagination/build-status/master)

Installation with Composer
--------------------------

[](#installation-with-composer)

```
$ composer require germania-kg/pagination
```

Overview
--------

[](#overview)

**Pagination:**Page numbering made easy! Supports *current, next, previous, first* and *last* page numbers as well as *number of pages* and customizable *page sizes*.

**PaginationFactory:**Callable class for creating a *Pagination* instance. Works great with `$_GET['page']`

**PaginationIterator:**Limits your *Traversables* according to the *Pagination* status. Useful for paginated **JSON API** resources.

**JsonApiPaginationDecorator:**Create useful `links` and `meta` information for your **JSON API** resource collection.

Usage
-----

[](#usage)

### The Pagination class

[](#the-pagination-class)

Just pass the number of items to paginate. The *Pagination* class will calculate the page numbers, based on a default page size of 25. See below for customization examples.

```
