/** @return Page<ProductResource> */
public function list(
?int $limit = null,
?int $offset = null,
?string $search = null,
?string $order = null,
int|float|null $timeout = null,
): PageFetches one page of the products the key can reach, unwrapped into items plus a pagination envelope. Private products with no grant for the key owner are filtered out before pagination is applied, so pagination['totalCount'] is the number of products this key can see and never the raw workspace total.
Every row carries locked, which is true for products sitting beyond the plan allowance. Locked products still list and still read, but an update against one is refused. search matches name and slug, order defaults to name and sorts A to Z, with asc and desc sorting oldest and newest first on createdAt.
Example
use Envless\Envless;
$envless = new Envless();
$page = $envless->products->list(limit: 10, search: 'api');
foreach ($page->items as $product) {
$locked = ($product['locked'] ?? false) ? ' (locked)' : '';
echo $product['slug'], $locked, PHP_EOL;
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
$limit | int | No | Rows per page, a whole number from 1 to 100. |
$offset | int | No | Rows to skip, a whole number of 0 or greater. |
$search | string | No | Case-insensitive substring match against product name and slug. |
$order | string | No | Defaults to name, which sorts A to Z. Pass asc for oldest first or desc for newest first on createdAt. |
$timeout | int|float | No | Seconds each attempt of this call may take, the response body included, before it throws Envless\Exception\NetworkException with isTimeout() true. Overrides the client's timeout for this call, and 0 turns the limit off. |
Returns
Page<ProductResource> holding items and the pagination envelope.
Reads the products collection. list returns one page as an Envless\Result\Page with items and pagination, listAll collects every page into an array, and iterate returns a Generator that yields one item at a time, fetching the next page only when the loop gets there.
Worth knowing
- A
limitoutside 1 to 100 is rejected as invalid pagination rather than clamped. - Pagination happens in memory after the access filter, so page boundaries shift if grants change between calls.
Required scopes
products:read
Underlying endpoint
GET /products
Request and response schema, every error code, and a live playground.
In TypeScript
envless.products.list()
The same method in @goenvless/sdk, with the same request, retries and errors.