Products

$envless->products->access->listAll()

Collect every member grant on a product

php
/** @return list<ProductAccessEntry> */
public function listAll(
    string $slug,
    ?int $limit = null,
    ?int $offset = null,
    int|float|null $timeout = null,
): array

Walks every page of the grants recorded on a product and returns one flat array of entries.

This drops the isPrivate flag that $envless->products->access->list() returns, because it streams items only. Without that flag the grant list on its own says nothing about who can read the product, so call $envless->products->access->list() once whenever the privacy state matters. An empty array means no grants are stored, not that nobody has access.

Example

php
use Envless\Envless;

$envless = new Envless();

$grants = $envless->products->access->listAll('billing');

foreach ($grants as $grant) {
    echo $grant['id'], PHP_EOL;
}

Parameters

ParameterTypeRequiredDescription
$slugstringYesProduct slug, or the product uniqueId when the value is UUID shaped.
$limitintNoPage size for each underlying request, capped at 100.
$offsetintNoRow to start the walk from.
$timeoutint|floatNoSeconds 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

An list<ProductAccessEntry>, each holding the workspace member id and a user summary.

Reads the access collection. list returns one page as an Envless\Result\ProductAccessPage 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

  • Grant lists are small in practice, so this is usually the right variant, with $envless->products->access->list() reserved for the privacy flag.

Required scopes

product-access:read

Underlying endpoint

GET /products/{slug}/access

Request and response schema, every error code, and a live playground.

In TypeScript

envless.products.access.listAll()

The same method in @goenvless/sdk, with the same request, retries and errors.