Overview
All list() methods return a Page<T> object. Every page includes the data array, metadata about the total result set, and links to the next/previous page.
The Page Object
Control pagination yourself with $page and $perPage:
Every resource exposes an iter() method that automatically fetches all pages and yields individual items:
Internally, iter() calls list() repeatedly, following links->next until there are no more pages.
Use iter() whenever you need all items. It handles pagination transparently and uses PHP generators, so it doesn’t load the full result set into memory at once.
Collecting into an Array
If you need a full array, use iterator_to_array():
| Parameter | Type | Default | Description |
|---|
$page | int|null | 1 | Page number (1-indexed) |
$perPage | int|null | 20 | Items per page (max 100) |