Skip to content

The official PHP library used for interacting with the BunnyCDN Storage API.

Notifications You must be signed in to change notification settings

DestinyMKas/BunnyCDN.PHP.Storage

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

BunnyCDN.PHP.Storage

The official PHP library used for interacting with the BunnyCDN Storage API.

How to use:

The storage library is very simple to use. First, create the basic BunnyCDNStorage object with the authentication details. It's the basic object for interaction with the API.

$bunnyCDNStorage = new BunnyCDNStorage("storagezonename", "MyAccessKey", "sg");

The BunnyCDNStorage constructor takes the following parameters:

  • storageZoneName - The name of your storage zone
  • apiAccessKey - The API access key (password)
  • storageZoneRegion - The storage zone region code (de, ny, or sg)

Navigation:


Uploading objects:

To upload a file to the storage, you can use the uploadFile method. If the path to the object does not exist yet, it will be automatically created.

$bunnyCDNStorage->uploadFile("local/file/path/helloworld.txt", "/storagezonename/helloworld.txt");

Listing objects:

Get a list of of all objects on the given path.

$bunnyCDNStorage->getStorageObjects("/storagezonename/");

The StorageObject contains the following properties:

  • Guid - The unique GUID of the file
  • UserId - The ID of the BunnyCDN user that holds the file
  • DateCreated - The date when the file was created
  • LastChanged - The date when the file was last modified
  • StorageZoneName - The name of the storage zone to which the file is linked
  • Path - The path to the object
  • ObjectName - The name of the object
  • Length - The total of the object in bytes
  • IsDirectory - True if the object is a directory, otherwise false.
  • ServerId - The ID of the storage server that the file resides on
  • StorageZoneId - The ID of the storage zone that the object is linked to
  • FullPath - The full path to the file

Downloading objects:

To download an object from the storage to a local file, you can use the downloadFile method.

$bunnyCDNStorage->downloadFile("/storagezonename/helloworld.txt", "local/file/path/helloworld.txt");

Deleting objects:

Deleting supports both files and directories. If the target object is a directory, the directory content will also be deleted.

$bunnyCDNStorage->deleteObject("/storagezonename/helloworld.txt");

About

The official PHP library used for interacting with the BunnyCDN Storage API.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%