PHP code example of ovk / fastly-php

1. Go to this page and download the library: Download ovk/fastly-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ovk / fastly-php example snippets


        
        ew GuzzleAdapter('fastly-api-key');
        $client = new Fastly($adapter, "default-service-id");
    

$adapter = new GuzzleAdapter('fastly-api-key');
$fastly = new Fastly($adapter, 'my-service-id');

$result = $fastly->send('GET', 'stats?from=1+day+ago');

$result = $fastly->purgeAll();

// Purge multiple urls
$result = $fastly->purge(['url1', 'url2', 'url3']);

// Purge multiple tags
$result = $fastly->purgeKey(['tag1', 'tag2', 'tag3']);

// Softpurge multiple tags
$result = $fastly->softPurgeKey(['tag1', 'tag2', 'tag3']);

$result = $fastly->service('another-service-id')->softPurgeKey(['tag1', 'tag2', 'tag3']);

$errors = $fastly->getError();
bash
        php composer.phar install --no-dev