Skip to content

Commit

Permalink
v1.9 separate class files for each main handler
Browse files Browse the repository at this point in the history
v1.9 separate class files for each main handler

* Updated project to have separate class files for each handler (Pull, Storage, Stream and DNS)
* Added class `BunnyAPIPull` for pullzone interaction
* Added class `BunnyAPIStorage` for storage interaction
* Added class `BunnyAPIStream` for video stream interaction
* Added class `BunnyAPIDNS` for DNS interaction
  • Loading branch information
cp6 committed Sep 26, 2022
1 parent 5232171 commit 0b0a870
Show file tree
Hide file tree
Showing 8 changed files with 947 additions and 915 deletions.
61 changes: 31 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,19 @@ BunnyCDN) pull, video streaming, DNS and storage zones [API](https://docs.bunny.
This class whilst having a main focus on storage zone interaction includes pull zone features. Combining API with FTP,
managing and using BunnyNet storage zones just got easier.

[![Generic badge](https://img.shields.io/badge/version-1.8-blue.svg)]()
[![Generic badge](https://img.shields.io/badge/version-1.9-blue.svg)]()
[![Generic badge](https://img.shields.io/badge/PHP-8.1-purple.svg)]()

### 1.8 changes
* Added DNS zone interaction
* Added `dns_example.php` file
* Added getStreamCollectionSize function
* Added getVideoStatistics function
* Added getVideoHeatmap function
* Added reEncodeVideo function
* Added fetchVideo function
* Added getCountries function
* Added getRegions function
* Added getAbuseCases function
* Added checkAbuseCase function
* Added getSupportTickets function
* Added getSupportTicketDetails function
* Added closeSupportTicket function
* Added createSupportTicket function
* Updated APIcall function (bool $storage_call replaced with string $url_type)
* Updated functions that use APIcall to use new $url_type parameter
* Updated listPullZones function
* Updated getStatistics function
* Updated findStorageZoneAccessKey function return type
* Updated getVideoCollections function
* Updated API_URL and VIDEO_STREAM_URL const strings
* Removed boolToInt function
* Removed jsonHeader function
### 1.9 changes
* Updated project to have separate class files for each handler (Pull, Storage, Stream and DNS)
* Added class `BunnyAPIPull` for pullzone interaction
* Added class `BunnyAPIStorage` for storage interaction
* Added class `BunnyAPIStream` for video stream interaction
* Added class `BunnyAPIDNS` for DNS interaction

### TODO
* Sort (features) and index the readme
* Create separate example files for each (pull, storage, video/stream and DNS)
* Create separate classes and src files for each (pull, storage, video/stream and DNS)

### Requirements

Expand Down Expand Up @@ -104,9 +84,9 @@ Use like:
```php
require __DIR__ . '/vendor/autoload.php';

use Corbpie\BunnyCdn\BunnyAPI;
use Corbpie\BunnyCdn\BunnyAPIPull;

$bunny = new bunnyAPI();//Initiate the class
$bunny = new BunnyAPIPull();//Initiate the class

echo $bunny->listPullZones();
```
Expand All @@ -131,6 +111,18 @@ $bunny->apiKey('XXXX-XXXX-XXXX');//Bunny api key

---

### Storage zone interaction

```php
require __DIR__ . '/vendor/autoload.php';

use Corbpie\BunnyCdn\BunnyAPIStorage;

$bunny = new BunnyAPIStorage();
```

---

Storage zone name and access key for storage zone interaction (**not needed if just using pull zone functions**)

Set ```$access_key = ''``` to obtain key automatically (storage name must be accurate)
Expand Down Expand Up @@ -619,7 +611,16 @@ $bunny->closeConnection();

---

## Video streaming
### Video streaming zone interaction

```php
require __DIR__ . '/vendor/autoload.php';

use Corbpie\BunnyCdn\BunnyAPIStream;

$bunny = new BunnyAPIStream();
```
---

**You can only get the video library id from your bunny.net stream library page**

Expand Down
4 changes: 2 additions & 2 deletions dns_example.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
require __DIR__ . '/vendor/autoload.php';

use Corbpie\BunnyCdn\BunnyAPI;
use Corbpie\BunnyCdn\BunnyAPIDNS;

$bunny = new BunnyAPI();
$bunny = new BunnyAPIDNS();

//Returns all DNS zones
$bunny->getDNSZones();
Expand Down
19 changes: 14 additions & 5 deletions example.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
require __DIR__ . '/vendor/autoload.php';

use Corbpie\BunnyCdn\BunnyAPI;
use Corbpie\BunnyCdn\BunnyAPIPull;

$bunny = new BunnyAPI();
$bunny = new BunnyAPIPull();
//Make sure API_KEY is set at line 9 bunnyAPI.php

/*
Expand All @@ -12,13 +12,13 @@
*
*/

echo $bunny->listPullZones();//Returns data for all Pull zones on account
echo json_encode($bunny->listPullZones());//Returns data for all Pull zones on account
//Here you will find the ID's for your pullZones

//Examples using pull zone id: 1337

//Individual pull zone data
$bunny->pullZoneData(1337);
echo json_encode($bunny->pullZoneData(26719));

//List hostnames for a pull zone
$bunny->pullZoneHostnames(1337);
Expand Down Expand Up @@ -78,6 +78,9 @@
*
*/

use Corbpie\BunnyCdn\BunnyAPIStorage;

$bunny = new BunnyAPIStorage();
//View all storage zones for account
echo $bunny->listStorageZones();//Returns data for all Storage zones on account

Expand All @@ -87,6 +90,9 @@
//List folders for storage zone 'homeimagebackups'
echo $bunny->listFolders();

//Check if a folder (path) exists by using its path
$bunny->folderExists('pets');//Returns true if exists

//Create a new folder
echo $bunny->createFolder('pets');//Creates a new folder called pets

Expand All @@ -110,13 +116,16 @@
echo $bunny->deleteFolder('pets/puppy_fluffy/');
echo $bunny->deleteFolder('pets/');


/*
*
* Video stream API examples
*
*/

use Corbpie\BunnyCdn\BunnyAPIStream;

$bunny = new BunnyAPIStream();

//List collections for library 1234
echo json_encode($bunny->getStreamCollections(1234));

Expand Down
Loading

0 comments on commit 0b0a870

Please sign in to comment.