Git Product home page Git Product logo

bunnycdn.php.storage's Introduction

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");

bunnycdn.php.storage's People

Contributors

sifex avatar dejanpelzel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.