Projects

$envless->projects->list()

Read one page of projects across products

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

Returns a single page of projects drawn from every product the key can reach, as items plus the raw pagination envelope. Nothing is fetched beyond that page, so read pagination['hasMore'] before assuming you have the whole set.

Project slugs are unique per product, not per workspace, so this flat list can legitimately hold two rows with the same slug. Key off id, or off the product['slug'] and slug pair. Every row carries its product array so you never need a second call to disambiguate. Pass product: to narrow to one product.

Example

php
use Envless\Envless;

$envless = new Envless();

$page = $envless->projects->list(product: 'billing', limit: 50);

foreach ($page->items as $project) {
    echo $project['product']['slug'] ?? '', ' ', $project['slug'], PHP_EOL;
}

Parameters

ParameterTypeRequiredDescription
$productstringNoProduct slug or product uniqueId to filter the list down to one product.
$limitintNoRows per page, a whole number from 1 to 100.
$offsetintNoRows to skip before the page starts.
$searchstringNoCase insensitive substring match against project name and slug.
$orderstringNoDefaults to name, which sorts A to Z. Pass asc for oldest first or desc for newest first on createdAt.
$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<ProjectResource> with items and the pagination envelope.

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

  • An unknown or inaccessible product: fails with 404 product.not_found, it does not quietly return an empty page.
  • Projects a restricted key cannot reach are simply absent from the page rather than rejected.

Required scopes

projects:read

Underlying endpoint

GET /projects

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

In TypeScript

envless.projects.list()

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