BunnyCDN is one of the fastest and most cost effective CDN.

With this BunnyCDN PHP Class you can easily implement it and turbo charge your website content to deliver it at lighting speed to your visitors.

Include BunnyCDN Class

To use the class just include in  your php project file like this:

include 'bunnycdn.php';

$cdn = new BunnyCDN();

Get Account API

To do any CRUD(create, read, update and delete) operation to your zones, you would need account API key

After that, you can assign that api key to a variable:

$account_key = 'your-bunnycdn-api-key';


Summary Of All The Functions 

Create New Zone
$d1 = $cdn->Account($account_key)->CreateNewZone($zone_name , $zone_url );

Get Zone
$zoneid = 35649; //35617
$d1 = $cdn->Account($account_key)->GetZone($zoneid);

Get Zone List
$d1 = $cdn->Account($account_key)->GetZoneList();

Purge URL
$purge_url = 'http://MyBunnyCDNSite.b-cdn.net/awesome-functions.min.js';
//$d1 = $cdn->Account($account_key)->PurgeURL($purge_url);

Purge Zone Cache
$d1 = $cdn->Account($account_key)->PurgeZoneCache($zoneid);

Add Host Name
$host_name_url = 'cdn.mybunnycdnsite.com';
$d1 = $cdn->Account($account_key)->AddHostName($zoneid,$host_name_url);

Delete Host Name
$host_name_url = 'cdn.mybunnycdnsite.com';
$d1 = $cdn->Account($account_key)->DeleteHostName($zoneid,$host_name_url);

Add Blocked IP
$blocked_ip = '153.208.102.234';
$d1 = $cdn->Account($account_key)->AddBlockedIP($zoneid,$blocked_ip);

Remove Blocked IP
$blocked_ip = '153.208.102.234';
$d1 = $cdn->Account($account_key)->RemoveBlockedIP($zoneid,$blocked_ip);

Stats
$d1 = $cdn->Account($account_key)->Stats();

Billing
$d1 = $cdn->Account($account_key)->Billing();

Apply Code
$promo_code = 'mycode';
$d1 = $cdn->Account($account_key)->ApplyCode($promo_code);

Delete Zone
$d1 = $cdn->Account($account_key)->DeleteZone($zoneid);

Put File 
$d1 = $cdn->Storage($storage_key)->PutFile($local_upload_file_path, $storage_zone_path, $storage_zone_file_path);

Get Storage Zone
$d1 = $cdn->Storage($storage_key)->GetStorageZone($storage_path);

Delete File
$d1 = $cdn->Storage($storage_key)->DeleteFile($storage_path);



Below are a list of zone functions with explanation how to use them and what are the result output.

Create New Zone(Website)

For the sake of simplicity, we will assume your site name(MyBunnyCDNSite) and its url (http://MyBunnyCDNSite.com). Moving forward we will use this site as example to do CRUD operation. 

Just use the below code to add a new website to bunnycdn network

$zone_name = 'MyBunnyCDNSite';
$zone_url = 'http://mybunnycdnsite.com';

$d1 = $cdn->Account($account_key)->CreateNewZone($zone_name  , $zone_url );

After the process is done, it will return array which will have an array object of status and others. 

If the status is "error", you want to look at the "msg" array object to find out more details.

Example of an error message:

{
   "status": "error",
   "http_code": 400,
   "msg": {
      "ErrorKey": "pullzone.name_taken",
      "Field": "Name",
      "Message": "The pull zone name is already taken."
   }
}

Success message would look like this:

{
   "status": "success",
   "zone_id": 35617,
   "zone_name": "MyBunnyCDNSite",
   "origin_url": "http://mybunnycdnsite.com",
   "cdn_url": "MyBunnyCDNSite.b-cdn.net",
   "zone_details": {
      "Id": 35617,
      "Name": "MyBunnyCDNSite",
      "OriginUrl": "http://mybunnycdnsite.com",
      "Enabled": true,
      "Hostnames": [
         {
            "Id": 46505,
            "Value": "MyBunnyCDNSite.b-cdn.net",
            "ForceSSL": false,
            "IsSystemHostname": true,
            "HasCertificate": true
         }
      ],
      "StorageZoneId": 0,
      "AllowedReferrers": [],
      "BlockedIps": [],
      "EnableGeoZoneUS": true,
      "EnableGeoZoneEU": true,
      "EnableGeoZoneASIA": true,
      "EnableGeoZoneSA": true,
      "EnableGeoZoneAF": true,
      "ZoneSecurityEnabled": false,
      "ZoneSecurityKey": "b69c3be0-4fa3-47dd-8a9f-d335400a47f9",
      "ZoneSecurityIncludeHashRemoteIP": false,
      "IgnoreQueryStrings": true,
      "MonthlyBandwidthLimit": 0,
      "MonthlyBandwidthUsed": 0,
      "AddHostHeader": false,
      "Type": 0,
      "CustomNginxConfig": "",
      "AccessControlOriginHeaderExtensions": [
         "eot",
         "ttf",
         "woff",
         "woff2",
         "css"
      ],
      "EnableAccessControlOriginHeader": true,
      "DisableCookies": true,
      "BudgetRedirectedCountries": [],
      "BlockedCountries": [],
      "DisableDualCache": false,
      "CacheControlMaxAgeOverride": -1,
      "BurstSize": 0,
      "RequestLimit": 0,
      "Disabled": false,
      "BlockRootPathAccess": false,
      "CacheQuality": 75,
      "LimitRatePerSecond": 0,
      "LimitRateAfter": 0,
      "ConnectionLimitPerIPCount": 0,
      "PriceOverride": 0,
      "AddCanonicalHeader": false,
      "EnableLogging": true,
      "IgnoreVaryHeader": true,
      "EnableCacheSlice": false,
      "EdgeRules": []
   }
}

Note -> "zone_id" is the most important part. You want to save that in your database somewhere as you will need it to do other CRUD operations.

Get Single Zone 

If you want to get information about a single zone, just use the zone id to get all of the information related to your bunnycdn zone.

//get single zone
$zoneid = 35617;
$d1 = $cdn->Account($account_key)->GetZone($zoneid);

 

Error message would look like this:

{
   "status": "error",
   "http_code": 404,
   "msg": null
}

Success message would look like this:

{
   "status": "success",
   "zone_id": 35617,
   "zone_name": "MyBunnyCDNSite",
   "origin_url": "http://mybunnycdnsite.com",
   "cdn_url": "MyBunnyCDNSite.b-cdn.net",
   "zone_details": {
      "Id": 35617,
      "Name": "MyBunnyCDNSite",
      "OriginUrl": "http://mybunnycdnsite.com",
      "Enabled": true,
      "Hostnames": [
         {
            "Id": 46505,
            "Value": "MyBunnyCDNSite.b-cdn.net",
            "ForceSSL": false,
            "IsSystemHostname": true,
            "HasCertificate": true
         }
      ],
      "StorageZoneId": 0,
      "AllowedReferrers": [],
      "BlockedIps": [],
      "EnableGeoZoneUS": true,
      "EnableGeoZoneEU": true,
      "EnableGeoZoneASIA": true,
      "EnableGeoZoneSA": true,
      "EnableGeoZoneAF": true,
      "ZoneSecurityEnabled": false,
      "ZoneSecurityKey": "b69c3be0-4fa3-47dd-8a9f-d335400a47f9",
      "ZoneSecurityIncludeHashRemoteIP": false,
      "IgnoreQueryStrings": true,
      "MonthlyBandwidthLimit": 0,
      "MonthlyBandwidthUsed": 0,
      "AddHostHeader": false,
      "Type": 0,
      "CustomNginxConfig": "",
      "AccessControlOriginHeaderExtensions": [
         "eot",
         "ttf",
         "woff",
         "woff2",
         "css"
      ],
      "EnableAccessControlOriginHeader": true,
      "DisableCookies": true,
      "BudgetRedirectedCountries": [],
      "BlockedCountries": [],
      "DisableDualCache": false,
      "CacheControlMaxAgeOverride": -1,
      "BurstSize": 0,
      "RequestLimit": 0,
      "Disabled": false,
      "BlockRootPathAccess": false,
      "CacheQuality": 75,
      "LimitRatePerSecond": 0,
      "LimitRateAfter": 0,
      "ConnectionLimitPerIPCount": 0,
      "PriceOverride": 0,
      "AddCanonicalHeader": false,
      "EnableLogging": true,
      "IgnoreVaryHeader": true,
      "EnableCacheSlice": false,
      "EdgeRules": []
   }
}

Get Zone List

If you want to get all of your zones for the account, you can easily do that by using:

$d1 = $cdn->Account($account_key)->GetZoneList();

Note > "zone_smry" array object will give you a summary with all of your zones for the account. Below is just details about our example site.

Success message would look like this:

{
   "status": "success",
   "zone_smry": [       
      {
         "zone_id": 35617,
         "zone_name": "MyBunnyCDNSite",
         "monthly_bandwidth_used": "0.00 B",
         "host_names": [
            "MyBunnyCDNSite.b-cdn.net"
         ]
      }
   ],
   "zone_details": [       
      {
         "Id": 35617,
         "Name": "MyBunnyCDNSite",
         "OriginUrl": "http://mybunnycdnsite.com",
         "Enabled": true,
         "Hostnames": [
            {
               "Id": 46544,
               "Value": "MyBunnyCDNSite.b-cdn.net",
               "ForceSSL": false,
               "IsSystemHostname": true,
               "HasCertificate": true
            }
         ],
         "StorageZoneId": 0,
         "AllowedReferrers": [],
         "BlockedIps": [],
         "EnableGeoZoneUS": true,
         "EnableGeoZoneEU": true,
         "EnableGeoZoneASIA": true,
         "EnableGeoZoneSA": true,
         "EnableGeoZoneAF": true,
         "ZoneSecurityEnabled": false,
         "ZoneSecurityKey": "75d773c5-7a22-43bf-b341-3394a660533d",
         "ZoneSecurityIncludeHashRemoteIP": false,
         "IgnoreQueryStrings": true,
         "MonthlyBandwidthLimit": 0,
         "MonthlyBandwidthUsed": 0,
         "AddHostHeader": false,
         "Type": 0,
         "CustomNginxConfig": "",
         "AccessControlOriginHeaderExtensions": [
            "eot",
            "ttf",
            "woff",
            "woff2",
            "css"
         ],
         "EnableAccessControlOriginHeader": true,
         "DisableCookies": true,
         "BudgetRedirectedCountries": [],
         "BlockedCountries": [],
         "DisableDualCache": false,
         "CacheControlMaxAgeOverride": -1,
         "BurstSize": 0,
         "RequestLimit": 0,
         "Disabled": false,
         "BlockRootPathAccess": false,
         "CacheQuality": 75,
         "LimitRatePerSecond": 0,
         "LimitRateAfter": 0,
         "ConnectionLimitPerIPCount": 0,
         "PriceOverride": 0,
         "AddCanonicalHeader": false,
         "EnableLogging": true,
         "IgnoreVaryHeader": true,
         "EnableCacheSlice": false,
         "EdgeRules": []
      }
   ]
}

Purge Single URL Cache

If you want to purge a single url from your zone, you can easily do it like this:

$purge_url = 'http://MyBunnyCDNSite.b-cdn.net/awesome-functions.min.js'; 
$d1 = $cdn->Account($account_key)->PurgeURL($purge_url);

Success message would look like this:

{
   "status": "success",
   "msg": {
      "http_code": 200,
      "data": ""
   }
}

Purge Zone Cache

If you want to purge/delete all cache data for your zone, just use the zone id to purge your bunnycdn zone.

//purge all cache for a single zone
$zoneid = 35617;
$d1 = $cdn->Account($account_key)->PurgeZoneCache($zoneid);

Error message would look like this:

{
   "status": "error",
   "http_code": 400,
   "msg": {
      "ErrorKey": "pullzone.not_found",
      "Field": "PullZone",
      "Message": "The requested pull zone was not found"
   }
}

Success message would look like this:

{
   "status": "success",
   "msg": {
      "http_code": 200,
      "data": ""
   }
}

Add Host Name

It's a good idea to add a host for your site because it will help your site in SEO. For example, instead of using "http://MyBunnyCDNSite.b-cdn.net", use "http://cdn.mybunnycdnsite.com".

//add host name
$zoneid = 35617;
$host_name_url = 'cd.mybunnycdnsite.com';
$d1 = $cdn->Account($account_key)->AddHostName($zoneid,$host_name_url);

Success message would look like this:

{
   "status": "success",
   "msg": {
      "http_code": 200,
      "data": ""
   }
}

Delete Host Name

You can easily delete a host name like this:

//add host name
$zoneid = 35617;
$host_name_url = 'cd.mybunnycdnsite.com';
$d1 = $cdn->Account($account_key)->DeleteHostName($zoneid,$host_name_url);

Success message would look like this:

{
   "status": "success",
   "msg": {
      "http_code": 200,
      "data": ""
   }
}

Add Blocked IP

There might be a time when you want block an ip address due to some evil hacker trying to access your information.

You can easily do it like this:

//add host name
$zoneid = 35617;
$blocked_ip = '153.208.102.234';
$d1 = $cdn->Account($account_key)->AddBlockedIP($zoneid,$host_name_url);

Success message would look like this:

{
   "status": "success",
   "msg": {
      "http_code": 200,
      "data": ""
   }
}

Remove Blocked IP

You can easily do it like this:

//add host name
$zoneid = 35617;
$blocked_ip = '153.208.102.234';
$d1 = $cdn->Account($account_key)->RemoveBlockedIP($zoneid,$host_name_url);

Success message would look like this:

{
   "status": "success",
   "msg": {
      "http_code": 200,
      "data": ""
   }
}

Stats

Easily get your account stats like this: 

$d1 = $cdn->Account($account_key)->Stats();

Success message would look like this:

{
   "status": "success",
   "msg": {
      "TotalBandwidthUsed": 219497192,
      "TotalRequestsServed": 3507,
      "CacheHitRate": 29.769033361847736,
      "BandwidthUsedChart": {         
         "2018-06-07T00:00:00Z": 7410118
      },
      "BandwidthCachedChart": {         
         "2018-06-07T00:00:00Z": 0
      },
      "CacheHitRateChart": {         
         "2018-06-07T00:00:00Z": 0
      },
      "RequestsServedChart": {         
         "2018-06-07T00:00:00Z": 161
      },
      "PullRequestsPulledChart": {          
         "2018-06-07T00:00:00Z": 161
      },
      "UserBalanceHistoryChart": {          
         "2018-06-07T00:05:07": 67.42
      },
      "UserStorageUsedChart": {          
         "2018-06-07T00:05:19": 168605868
      },
      "GeoTrafficDistribution": {
         "EU: London, UK": 4867719,
         "NA: Los Angeles, CA": 615127,
         "NA: Atlanta, GA": 10219458,
         "OC: Sydney, SYD": 234410,
         "EU: Bucharest, RO": 184722,
         "Asia: Tokyo, JP": 258935,
         "EU: Paris, FR": 514125,
         "NA: New York City, NY": 127231636,
         "NA: Miami, FL": 410682,
         "EU: Amsterdam, NL": 275735,
         "US: San Jose, CA": 82453,
         "SA: Sao Paulo, BR": 379085,
         "EU: Madrid, ES": 141779,
         "NA: Seattle, WA": 12560769,
         "NA: Chicago, IL": 16927249,
         "EU: Stockholm, SE": 916319,
         "EU: Moscow, RU": 547246,
         "EU: Milan, IT": 497757,
         "AF: Johannesburg, ZA": 203406,
         "Asia: Bangalore, IN": 11443699,
         "Asia: Istanbul, TR": 98836,
         "EU: Warsaw, PL": 5216237,
         "NA: Toronto, CA": 2974711,
         "Asia: Singapore, SG": 1709183,
         "EU: Frankfurt, DE": 11451085,
         "NA: Dallas, TX": 9534829
      },
      "Error3xxChart": {          
         "2018-06-07T00:00:00Z": 0
      },
      "Error4xxChart": {          
         "2018-06-07T00:00:00Z": 0
      },
      "Error5xxChart": { 
         "2018-06-07T00:00:00Z": 0
      }
   }
}

Billing

You can easily get all your billing information like this:

//Billing
$d1 = $cdn->Account($account_key)->Billing();

Success message would look like this:

{
   "status": "success",
   "msg": {
      "Balance": 6700.42080025938952,
      "ThisMonthCharges": 0.0007189317386339484,
      "BillingRecords": [
         {
            "Id": 34500,
            "PaymentId": null,
            "Amount": 0.024197671638093405,
            "Payer": "",
            "Timestamp": "2018-06-01T01:02:01",
            "Type": 3,
            "InvoiceAvailable": false
         },         
      ],
      "MonthlyChargesStorage": 0.00045701057863394885,
      "MonthlyChargesEUTraffic": 0.000022547659999999998,
      "MonthlyChargesUSTraffic": 0.00016685994,
      "MonthlyChargesASIATraffic": 0.00005098533,
      "MonthlyChargesSATraffic": 0.00001302155
   }
}

Apply Code

If you have a promo code that you would like to use to save some money, you can apply it like this:

//ApplyCode
$promo_code = 'mycode';
$d1 = $cdn->Account($account_key)->ApplyCode($promo_code);

If you are it correct, your status will be "success" else your will get status as "error" like this:

{
   "status": "error",
   "http_code": 400,
   "msg": {
      "ErrorKey": "code.invalid",
      "Field": "CouponCode",
      "Message": "The entered code is invalid."
   }

Delete Single Zone

If you want to delete your zone, just use the zone id to delete your bunnycdn zone.

//delete a single zone
$zoneid = 35617;
$d1 = $cdn->Account($account_key)->DeleteZone($zoneid);

Error message would look like this:

{
   "status": "error",
   "http_code": 400,
   "msg": {
      "ErrorKey": "pullzone.not_found",
      "Field": "PullZone",
      "Message": "The requested pull zone was not found"
   }
}

Success message would look like this:

{
   "status": "success",
   "msg": {
      "http_code": 302,
      "data": ""
   }
}

Storage Functions

Unfortunately, you can't create a storage zone via the api. You will have to manually create a storage zone.

After you have created a storage zone, you can get the api key(or might be labeled "password") of it. For our example, the storage zone name is "mybunnycdnsite".

Next,  you can assign that api key to a variable:

$storage_key = 'your-storage-api-key';

Put File Into Root Of Storage Zone

You can easily add/upload a file to your storage zone like this:

//PutFile
$local_upload_file_path = 'file/video1.mp4';
$storage_zone_path = '/mybunnycdnsite';
$storage_zone_file_path = '/my test file-'.uniqid().'.mp4';

$d1 = $cdn->Storage($storage_key)->PutFile($local_upload_file_path, $storage_zone_path, $storage_zone_file_path);

local_upload_file_path = is the folder on your server where the file is located.

storage_zone_path = is your storage zone name.

storage_zone_file_path = where the file will be uploaded and a name of the file. 

Success message would look like this:

{
   "status": "success",
   "file_name": "my-test-file-5b1994db6d265.mp4",
   "storage_file_path": "/mybunnycdnsite/my-test-file-5b1994db6d265.mp4",
   "cdn_file_path": "/my-test-file-5b1994db6d265.mp4",
   "msg": ""
}

In order for you to download or view your file, you will have to connect your storage zone to a pull zone. For our example, I have created and connected to a pull zone (mybunnycdnsite).

To Access The File

I will be using hostname (https://mybunnycdnsite.b-cdn.net) to access the files.

If I want to access the file (my-test-file-5b1994db6d265.mp4) that I just uploaded it to root folder, I can use the hostname and "cdn_file_path" like this: https://mybunnycdnsite.b-cdn.net/my-test-file-5b1994db6d265.mp4

Put File Into Subfolder Of Storage Zone

You can easily add/upload a file to your storage zone like this:

//PutFile
$local_upload_file_path = 'file/video1.mp4';
$storage_zone_path = '/mybunnycdnsite';
$storage_zone_file_path = '/my-assets/my test file-'.uniqid().'.mp4';

$d1 = $cdn->Storage($storage_key)->PutFile($local_upload_file_path, $storage_zone_path, $storage_zone_file_path);

"storage_zone_file_path" makes is easier for you to create subfolders on the fly.

For example, if you want to create a subfolder (my-assets) and in this folder you want to upload your file, you can easily just put this "/my-assets/my test file-'.uniqid().'.mp4".

Success message would look like this:

{
   "status": "success",
   "file_name": "my-test-file-5b199527f21a5.mp4",
   "storage_file_path": "/mybunnycdnsite/my-assets/my-test-file-5b199527f21a5.mp4",
   "cdn_file_path": "/my-assets/my-test-file-5b199527f21a5.mp4",
   "msg": ""
}

To Access The File

I will be using hostname (https://mybunnycdnsite.b-cdn.net) to access the files.

If I want to access the file (my-test-file-5b199527f21a5.mp4) that I just uploaded it to root folder, I can use the hostname and "cdn_file_path" like this: https://mybunnycdnsite.b-cdn.net//my-assets/my-test-file-5b199527f21a5.mp4

Get Storage Zone

To get all the assets in your storage zone, get it like this:

//GetStorageZone
$storage_path = '/mybunnycdnsite/';
$d1 = $cdn->Storage($storage_key)->GetStorageZone($storage_path);

Note > in your "$storage_path" the last "/" is needed.

This will not work " $storage_path = '/mybunnycdnsite';

It need to be in this format: $storage_path = '/mybunnycdnsite/';

Success message would look like this:

This will get all the files and folder from root folder

{
   "status": "success",
   "zone_smry": {
      "folders": [
         {
            "storage_zone_name": "mybunnycdnsite",
            "main_folder": "/mybunnycdnsite/",
            "sub_folder": "my-assets",
            "folder_path": "/mybunnycdnsite/my-assets"
         }
      ],
      "files": [
         {
            "storage_zone_name": "mybunnycdnsite",
            "folder_path": "/",
            "file_name": "my-test-file-5b1994db6d265.mp4",
            "file_zone_path": "/mybunnycdnsite/my-test-file-5b1994db6d265.mp4",
            "file_dl_path": "/my-test-file-5b1994db6d265.mp4"
         }
      ]
   },
   "zone_details": [
      {
         "FailIndex": 0,
         "Guid": "810a3cf2-95b6-4c78-9c61-aea286498452",
         "StorageZoneName": "mybunnycdnsite",
         "Path": "/mybunnycdnsite/",
         "ObjectName": "my-assets",
         "Length": 0,
         "LastChanged": "2018-06-07T20:27:20.739",
         "ServerId": 0,
         "IsDirectory": true,
         "UserId": "5d34f9cf-1331-48af-b735-dbb9793ce653",
         "DateCreated": "2018-06-07T20:27:20.739",
         "StorageZoneId": 12811
      },
      {
         "FailIndex": 0,
         "Guid": "9c647f89-1d27-488a-96c1-144c8e73c3bc",
         "StorageZoneName": "mybunnycdnsite",
         "Path": "/mybunnycdnsite/",
         "ObjectName": "my-test-file-5b1994db6d265.mp4",
         "Length": 2308426,
         "LastChanged": "2018-06-07T20:26:04.189",
         "ServerId": 27,
         "IsDirectory": false,
         "UserId": "5d34f9cf-1331-48af-b735-dbb9793ce653",
         "DateCreated": "2018-06-07T20:26:04.189",
         "StorageZoneId": 12811
      }
   ]
}

If we want to get files in the subfolder(my-assets),  we would call it like this:

$storage_path = '/mybunnycdnsite/my-assets/';
$d1 = $cdn->Storage($storage_key)->GetStorageZone($storage_path);


Success message would look like this:

{
   "status": "success",
   "zone_smry": {
      "folders": [],
      "files": [
         {
            "storage_zone_name": "mybunnycdnsite",
            "folder_path": "/my-assets/",
            "file_name": "my-test-file-5b199527f21a5.mp4",
            "file_zone_path": "/mybunnycdnsite/my-assets/my-test-file-5b199527f21a5.mp4",
            "file_dl_path": "/my-assets/my-test-file-5b199527f21a5.mp4"
         }
      ]
   },
   "zone_details": [
      {
         "FailIndex": 0,
         "Guid": "4cdace8f-5664-49f5-9bb2-b949b561681e",
         "StorageZoneName": "mybunnycdnsite",
         "Path": "/mybunnycdnsite/my-assets/",
         "ObjectName": "my-test-file-5b199527f21a5.mp4",
         "Length": 2308426,
         "LastChanged": "2018-06-07T20:27:20.757",
         "ServerId": 29,
         "IsDirectory": false,
         "UserId": "5d34f9cf-1331-48af-b735-dbb9793ce653",
         "DateCreated": "2018-06-07T20:27:20.757",
         "StorageZoneId": 12811
      }
   ]
}

Delete File From Storage Zone

To delete a file from your storage zone, you can easily do it like this:

Note > this path (/mybunnycdnsite/my-test-file-5b1994db6d265.mp4) is given to you when you uploaded the file under "Put File" section. 

It's under object "storage_file_path": "/mybunnycdnsite/my-test-file-5b1994db6d265.mp4"

//DeleteFile
$storage_path = '/mybunnycdnsite/my-test-file-5b1994db6d265.mp4';
$d1 = $cdn->Storage($storage_key)->DeleteFile($storage_path);

Success message would look like this:

{
   "status": "success",
   "msg": {
      "http_code": 200,
      "data": ""
   }
}

Delete file from subfolder (my-assets):

//DeleteFile
$storage_path = '/mybunnycdnsite/my-assets/my-test-file-5b199527f21a5.mp4';
$d1 = $cdn->Storage($storage_key)->DeleteFile($storage_path);

Success message would look like this:

{
   "status": "success",
   "msg": {
      "http_code": 200,
      "data": ""
   }
}

Delete whole subfolder (my-assets):

//DeleteFile
$storage_path = '/mybunnycdnsite/my-assets/';
$d1 = $cdn->Storage($storage_key)->DeleteFile($storage_path);

Success message would look like this:

{
   "status": "success",
   "msg": {
      "http_code": 200,
      "data": ""
   }
}






Name

Email

Website

Comment

Post Comment