PHPackages                             catlabinteractive/cursor-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. [API Development](/categories/api)
4. /
5. catlabinteractive/cursor-pagination

ActiveLibrary[API Development](/categories/api)

catlabinteractive/cursor-pagination
===================================

Cursor pagination for REST APIs.

v1.0.8(6y ago)82.1k↓77.6%2MITPHPPHP &gt;=7.0.0CI failing

Since May 25Pushed 3y ago1 watchersCompare

[ Source](https://github.com/CatLabInteractive/cursor-pagination)[ Packagist](https://packagist.org/packages/catlabinteractive/cursor-pagination)[ RSS](/packages/catlabinteractive-cursor-pagination/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (10)Dependencies (2)Versions (14)Used By (2)

cursor-pagination
=================

[](#cursor-pagination)

[![Build Status](https://camo.githubusercontent.com/31f3f6ee4b3c7bf8501265cc79e008d2feda62e558ad0593ce23d36f61b6ad0f/68747470733a2f2f7472617669732d63692e6f72672f4361744c6162496e7465726163746976652f637572736f722d706167696e6174696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/CatLabInteractive/cursor-pagination)

Cursor pagination for REST APIs.

Goal
====

[](#goal)

Provide cursor based pagination to APIs or webservices. The library calculates the sql query parameters and the cursors that should be passed through the requests.

So, like LIMIT {offset}, {records}?
===================================

[](#so-like-limit-offset-records)

Cursor based pagination is generally more performant than page based pagination (using SQL offset) since it filters the records instead of limiting the amount of records returned.

For changing data cursor based pagination is also more correct, since adding a row to the beginning of a list might shift all records.

For more information, head over to this [excellent article](https://www.sitepoint.com/paginating-real-time-data-cursor-based-pagination/).

Example
=======

[](#example)

```
