# Pagination

Shopify recently changed their pagination to [cursor-based pagination](https://shopify.dev/tutorials/make-paginated-requests-to-rest-admin-api), which require you grab relevant info from the "Link" header.

We've tried to simplify this by wrapping the logic in a `Cursor` object that implements the `Iterator` interface.

Example of usage:

```php
$pages = $shopify->paginateProducts(['limit' => 100]); // returns Cursor

$results = collect();

foreach ($pages as $page) {
    // $page is a Collection of ApiResources
    $results = $results->merge($page);
}
```
