Members

$envless->members->list()

Read one page of accepted workspace members

php
/** @return Page<MemberResource> */
public function list(
    ?int $limit = null,
    ?int $offset = null,
    ?string $search = null,
    ?string $roleId = null,
    int|float|null $timeout = null,
): Page

Returns one page of everyone who has accepted membership of the workspace, as items plus the raw pagination envelope. Each row carries the member id that update, remove and the product access routes expect, the assigned role, and the underlying user.

search matches a member name, email or role name, and roleId keeps only the members holding that role. Pending invites are not members and never show up in these rows: read them from the invites namespace.

Example

php
use Envless\Envless;

$envless = new Envless();

$page = $envless->members->list(limit: 50);

foreach ($page->items as $member) {
    echo $member['id'], ' ', $member['role']['name'] ?? 'no role', PHP_EOL;
    echo $member['user']['email'] ?? '', PHP_EOL;
}

Parameters

ParameterTypeRequiredDescription
$limitintNoRows per page, a whole number from 1 to 100.
$offsetintNoRows to skip before the page starts.
$searchstringNoCase insensitive substring match on the member name, email or role name.
$roleIdstringNoOnly members holding this role, by the role id from $envless->roles->list().
$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

Page<MemberResource> with items and the pagination envelope.

Reads the members 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

  • The API reads the whole member set and paginates it in memory, so pagination['totalCount'] is exact.
  • user can be null when the user record cannot be resolved. role is always populated for a real member.
  • A limit above 100 or a fractional offset fails with 400 request.invalid_pagination and error.field names the culprit.

Required scopes

members:read

Underlying endpoint

GET /members

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

In TypeScript

envless.members.list()

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