timclifford / fastly_crudl
This package is abandoned and no longer maintained.
No replacement package was suggested.
A PHP wrapper for using Fastly API
v2.2.1
2020-12-15 08:48 UTC
Requires
- php: ~7.3
- ext-json: *
- ext-openssl: *
- guzzlehttp/guzzle: ^6.5
Requires (Dev)
- phpunit/phpunit: >=8.0
- squizlabs/php_codesniffer: ^3.0
- vlucas/phpdotenv: ^4.1
- dev-master
- v2.2.1
- v2.2.0
- dev-renovate/phpunit-phpunit-10.x-lockfile
- dev-renovate/vlucas-phpdotenv-4.x-lockfile
- dev-renovate/squizlabs-php_codesniffer-3.x-lockfile
- dev-renovate/phpunit-phpunit-9.x-lockfile
- dev-renovate/vlucas-phpdotenv-5.x
- dev-renovate/php-8.x
- dev-renovate/packagist-guzzlehttp/guzzle-vulnerability
This package is auto-updated.
Last update: 2024-08-23 11:02:59 UTC
README
PHP wrapper for Fastly API
Requires Fastly API key and service id environment variables to be set.
For example:
export FASTLY_API_KEY="2arxxxxxxxxxxxxxxxxxxxxxxxxRIL" export FASTLY_SERVICE_ID="5CLxxxxxxxxxxxxxxxxxxOoLP"
or store inside .env
file
Usage
You can install the package via composer:
composer require ....
Connect to a Fastly API by creating a new Fastly object with an API token and Service ID:
use Fastly\Fastly;
...
$fastly_api_key = getenv('FASTLY_API_KEY');
$fastly_service_id = getenv('FASTLY_SERVICE_ID');
$fastly = new Fastly($fastly_api_key, $fastly_service_id);
Then you are able to send requests to the API.
Generic Send Requests
You can define the method, API uri path and provide options which will go ito the body of the request here.
// Get stats $stats = $fastly->send('GET', 'stats?from=1+day+ago'); // Get Keys $keys = $fastly->send('GET', 'tls/private_keys'); // Get Single Key $key = $fastly->send('GET', 'tls/private_keys/2XbVFa2kUN1d4rGDBFYkzp'); // Get Domains $domain = $fastly->send('GET', 'service/'. $fastly_service_id .'/version/1/domain/check_all'); $domains = $fastly->send('GET', 'tls/domains'); // Get activations $activations = $fastly->send('GET', 'tls/activations'); // Get Certificates $certificates = $fastly->send('GET', 'tls/certificates'); $certificate = $fastly->send('GET', 'tls/certificates/1JP0gerEJXIxImRnRLckug'); // Purge all $purge = $fastly->send('POST', 'service/'. $fastly_service_id .'/purge_all');
Private Keys
$private_keys = $fastly->private_keys; $get_keys = $private_keys->get_private_keys(); $key = $private_keys->get_private_key($id); $new_key = $private_keys->send_private_key($key, $name = '');
Certificates
$certificates = $fastly->certificates; $certificates->get_tls_certificates(); $certificates->get_tls_certificate("1JP0gerEJXIxImRnRLckug"); $certificates->send_tls_certificate($cert); $certificates->update_tls_certificate($id, $certificate); $certificates->delete_tls_certificate($id);