PHP code example of cloudinary / media-delivery-api

1. Go to this page and download the library: Download cloudinary/media-delivery-api 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/ */

    

cloudinary / media-delivery-api example snippets





 Configure Cloudinary URL: basicAuth
$config = Cloudinary\MediaDelivery\Configuration::getDefaultConfiguration()
              ->setCloudinaryUrl('cloudinary://key:secret@cloud_name');

$apiInstance = new Cloudinary\MediaDelivery\Api\CacheApi(null, $config);

$cache_invalidate_request_payload = new \Cloudinary\MediaDelivery\Model\CacheInvalidateRequestPayload(); // \Cloudinary\MediaDelivery\Model\CacheInvalidateRequestPayload | Payload to invalidate the cache

try {
    $apiInstance->invalidate($cache_invalidate_request_payload);
} catch (Exception $e) {
    echo 'Exception when calling CacheApi->invalidate: ', $e->getMessage(), PHP_EOL;
}