You are viewing documentation for an outdated version. It is no longer supported!
Pagination
Two approaches are offered to set pagination. A cursor-based and a page-based approach.
Limit & Offset
limit()
and offset()
allow you to limit your results, via a traditional cursor-based pagination.
$response = $client
->limit(10)
->offset(5)
->get('/users');
default
/users?limit=10&offset=5
json api
/users?page[limit]=10&page[offset]=5
odata
/users?$top=10&$skip=5
Take & Skip
take()
and skip()
are aliases for limit()
and offset()
. These have been added for the sake of convenience and are inspired by Laravel's Query Builder.
$response = $client
->take(10)
->skip(5)
->get('/users');
default
/users?limit=10&offset=5
json api
/users?page[limit]=10&page[offset]=5
odata
/users?$top=10&$skip=5
Page & Show
If supported by the target API, you can use the page-based pagination methods instead.
$response = $client
->page(3)
->show(25)
->get('/users');
default
/users?page=3&show=25
json api
/users?page[number]=3&page[size]=25
odata
Warning: Page-based pagination is not supported by OData
/users