/** @return list<VersionEntryResource> */
public function listAllEntries(
string $project,
string $environment,
?int $limit = null,
?int $offset = null,
?string $product = null,
int|float|null $timeout = null,
): arrayWalks every page and returns one array holding every version entry in the environment. This is the shape a rotation wants: decrypt each value and defaultValue with the old key, re-encrypt with the new one, then write the results back in batches through reencryptEntries.
It holds the entire encrypted history of the environment in memory at once, and the server rebuilds that history on every request, so prefer iterateEntries on a large environment. limit: only sets the page size used while walking, clamped to 100, it does not cap how many entries come back.
Envless::rotateWorkspacePassphrase() already does this walk plus the re-encryption and the batched write back for both live variables and history, so call this directly only when you need a custom rotation.
Example
use Envless\Envless;
$envless = new Envless();
$entries = $envless->versions->listAllEntries(
'api',
'production',
product: 'billing',
);
$encrypted = array_filter(
$entries,
static fn(array $entry): bool => $entry['value'] !== null,
);
echo count($encrypted), PHP_EOL;Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
$project | string | Yes | Project slug or project uniqueId. |
$environment | string | Yes | Environment slug, since an environment uniqueId will not resolve here. |
$product | string | No | Product slug used to disambiguate a project slug shared across products. |
$limit | int | No | Page size used while walking, clamped to 100. |
$offset | int | No | Row to start the walk from. |
$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
list<VersionEntryResource> holding every entry across every version of the environment.
Reads the entries 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
- Entries with a
nullvaluedo occur. Skip them instead of feeding them to a decrypt call. - Split the array into batches of at most 200 before writing it back, since a longer
entriesarray is rejected with 400.
Required scopes
versions:read and variables:read
Underlying endpoint
GET /projects/{slug}/environments/{environmentSlug}/versions/entries
Request and response schema, every error code, and a live playground.
In TypeScript
envless.versions.listAllEntries()
The same method in @goenvless/sdk, with the same request, retries and errors.