Skip to main content
Version: 1.2.0-beta

Environment API

The environment endpoint contains only the cache purge for the time being.

Cache purge#

The cache purge call will return an instance of the Response-object.
View in API Docs

$environmentId = 123;$files = [    'https://example.com/some/path.html',    'https://example.com/some/other/path.html',];$prefixes = [    'https://example.com/some/prefix/path',    'https://example.com/some/other/prefix/path',];$client->environment->purgeCache($environmentId, $files, $prefixes);

You can also specify the environment ID in the chained method calls.

$files = [    'https://example.com/some/path.html',    'https://example.com/some/other/path.html',];$prefixes = [    'https://example.com/some/prefix/path',    'https://example.com/some/other/prefix/path',];$client->environment($environmentId)->purgeCache($files, $prefixes);

Cache purge for Servebolt CDN#

The cache purge call will return an instance of the Response-object.
View in API Docs

$environmentId = 123;$hosts = [    'example.com',    'domain.com',];$client->environment->purgeCdnCache($environmentId, $hosts);

Get#

Returns a specific environment by ID.
View in API Docs

$response = $client->environment->get(123);if (    $response->wasSuccessful()     && $item = $response->getFirstResultItem()) {    // Do something    echo $item->id; // 123}

Update#

Updated an environment by ID.
View in API Docs

$response = $client->environment->update(123, [    'attributes' => [        'title' => 'Updated title'    ]]);if ($response->wasSuccessful()) {    // Cronjob updated}