fastly / fastly
A PHP client library for interacting with most facets of the Fastly API.
Installs: 563 815
Dependents: 4
Suggesters: 0
Security: 0
Stars: 24
Watchers: 78
Forks: 34
Open Issues: 3
Requires
- php: >=7.3
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^7.3
- guzzlehttp/psr7: ^1.7 || ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.12
- dev-main
- v6.0.0
- v5.10.0
- v5.9.0
- v5.8.0
- v5.7.0
- v5.6.0
- v5.5.0
- v5.4.0
- v5.3.0
- v5.2.0
- v5.1.0
- v5.0.1
- v5.0.0
- v4.2.2
- v4.2.1
- v4.2.0
- v4.1.1
- v4.1.0
- v4.0.0
- v3.0.3
- v3.0.2
- v3.0.1
- v3.0.0
- v2.3.1
- v2.3.0
- v2.2.2
- v2.2.1
- v2.2.0
- v2.1.1
- v2.1.0
- v2.0.0
- v1.3.1
- v1.3.0
- v1.2.0
- v1.1.0
- v1.0.1-alpha0
- v1.0.0
- 1.0.0-beta3
- v1.0.0-beta2
- v1.0.0-beta1
- v1.0.0-alpha3
- 1.0.0-alpha2
- 1.0.0-alpha1
- v0.4.x-dev
- v0.4.1
- v0.4.0
- v0.3.0
- v0.2.1
- v0.2.0
- v0.1.0
- dev-1.0.0-beta
- dev-kats/alpha-3
- dev-dora-alpha-3
This package is auto-updated.
Last update: 2024-12-06 07:00:45 UTC
README
A PHP client library for interacting with most facets of the Fastly API.
Installation
Requires PHP 7.3 or later.
To install via Composer, add the following to your project's composer.json
:
{ "require": { "fastly/fastly": "*@dev" } }
Then run composer install
.
Composer generates a vendor/autoload.php
file. You can include this file and start using the classes provided by this client without any extra work:
<?php require_once('/path/to/project/vendor/autoload.php');
Usage
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Authorize the client with a Fastly API token. $config = Fastly\Configuration::getDefaultConfiguration()->setApiToken('YOUR_API_TOKEN'); // Alternatively, set the FASTLY_API_TOKEN environment variable: // $config = Fastly\Configuration::getDefaultConfiguration(); $apiInstance = new Fastly\Api\( // Optionally, pass a custom client that implements `GuzzleHttp\ClientInterface`. // `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $options['service_id'] = 'SU1Z0isxPaozGVKXdv0eY'; // string $options['version_id'] = 56; // int $options['name'] = 'my_acl'; // string try { $result = $apiInstance->createAcl($options); print_r($result); } catch (Exception $e) { echo 'Exception when calling AclApi->createAcl: ', $e->getMessage(), PHP_EOL; }
Authorization
Note
The Fastly API requires an API token for most operations.
Set up the API token in the PHP client by using the setApiToken
method of a configuration as shown:
Fastly\Configuration::getDefaultConfiguration()->setApiToken('YOUR_API_TOKEN');
Alternatively, set the FASTLY_API_TOKEN
environment variable instead of using setApiToken
.
Fastly\Configuration::getDefaultConfiguration();
API Endpoints
The main documentation for the Fastly API can be found on our Developer Hub.
Table of API endpoints
Issues
The fastly-php API client currently does not support the following endpoints:
/alerts/definitions/{definition_id}
(DELETE, GET, PUT)/alerts/definitions
(GET, POST)/alerts/history
(GET)/dns/configurations/{dns_configuration_id}
(DELETE, GET, PATCH)/dns/configurations
(GET, POST)/domains/v1/{domain_id}
(DELETE, GET, PATCH)/domains/v1
(GET, POST)/notifications/integration-types
(GET)/notifications/integrations/{integration_id}/rotateSigningKey
(POST)/notifications/integrations/{integration_id}/signingKey
(GET)/notifications/integrations/{integration_id}
(DELETE, GET, PATCH)/notifications/integrations
(GET, POST)/notifications/mailinglist-confirmations
(POST)/resources/stores/kv/{store_id}/batch
(PUT)/security/workspaces/{workspace_id}/events/{event_id}
(GET, PATCH)/security/workspaces/{workspace_id}/events
(GET)/security/workspaces/{workspace_id}/redactions/{redaction_id}
(DELETE, GET, PATCH)/security/workspaces/{workspace_id}/redactions
(GET, POST)/security/workspaces/{workspace_id}/requests/{request_id}
(GET)/security/workspaces/{workspace_id}/requests
(GET)/security/workspaces/{workspace_id}/rules/{rule_id}
(DELETE, GET, PATCH)/security/workspaces/{workspace_id}/rules
(GET, POST)/security/workspaces/{workspace_id}/timeseries
(GET)/security/workspaces/{workspace_id}/virtual-patches/{virtual_patch_id}
(GET, PATCH)/security/workspaces/{workspace_id}/virtual-patches
(GET)/security/workspaces/{workspace_id}
(DELETE, GET, PATCH)/security/workspaces
(GET, POST)/tls/activations/{tls_activation_id}
(GET, PATCH)/tls/activations
(GET)/tls/configurations/{tls_configuration_id}
(DELETE, GET, PATCH)/tls/configurations
(GET, POST)/v1/channel/{service_id}/ts/h/limit/{max_entries}
(GET)/v1/channel/{service_id}/ts/h
(GET)/v1/channel/{service_id}/ts/{start_timestamp}
(GET)
If you encounter any non-security-related bug or unexpected behavior, please file an issue using the bug report template.
Security issues
Please see our SECURITY.md for guidance on reporting security-related issues.
License
MIT.