Skip to content

Commit 0b0a870

Browse files
committed
v1.9 separate class files for each main handler
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
1 parent 5232171 commit 0b0a870

File tree

8 files changed

+947
-915
lines changed

8 files changed

+947
-915
lines changed

README.md

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,19 @@ BunnyCDN) pull, video streaming, DNS and storage zones [API](https://docs.bunny.
66
This class whilst having a main focus on storage zone interaction includes pull zone features. Combining API with FTP,
77
managing and using BunnyNet storage zones just got easier.
88

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

12-
### 1.8 changes
13-
* Added DNS zone interaction
14-
* Added `dns_example.php` file
15-
* Added getStreamCollectionSize function
16-
* Added getVideoStatistics function
17-
* Added getVideoHeatmap function
18-
* Added reEncodeVideo function
19-
* Added fetchVideo function
20-
* Added getCountries function
21-
* Added getRegions function
22-
* Added getAbuseCases function
23-
* Added checkAbuseCase function
24-
* Added getSupportTickets function
25-
* Added getSupportTicketDetails function
26-
* Added closeSupportTicket function
27-
* Added createSupportTicket function
28-
* Updated APIcall function (bool $storage_call replaced with string $url_type)
29-
* Updated functions that use APIcall to use new $url_type parameter
30-
* Updated listPullZones function
31-
* Updated getStatistics function
32-
* Updated findStorageZoneAccessKey function return type
33-
* Updated getVideoCollections function
34-
* Updated API_URL and VIDEO_STREAM_URL const strings
35-
* Removed boolToInt function
36-
* Removed jsonHeader function
12+
### 1.9 changes
13+
* Updated project to have separate class files for each handler (Pull, Storage, Stream and DNS)
14+
* Added class `BunnyAPIPull` for pullzone interaction
15+
* Added class `BunnyAPIStorage` for storage interaction
16+
* Added class `BunnyAPIStream` for video stream interaction
17+
* Added class `BunnyAPIDNS` for DNS interaction
3718

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

4323
### Requirements
4424

@@ -104,9 +84,9 @@ Use like:
10484
```php
10585
require __DIR__ . '/vendor/autoload.php';
10686

107-
use Corbpie\BunnyCdn\BunnyAPI;
87+
use Corbpie\BunnyCdn\BunnyAPIPull;
10888

109-
$bunny = new bunnyAPI();//Initiate the class
89+
$bunny = new BunnyAPIPull();//Initiate the class
11090

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

132112
---
133113

114+
### Storage zone interaction
115+
116+
```php
117+
require __DIR__ . '/vendor/autoload.php';
118+
119+
use Corbpie\BunnyCdn\BunnyAPIStorage;
120+
121+
$bunny = new BunnyAPIStorage();
122+
```
123+
124+
---
125+
134126
Storage zone name and access key for storage zone interaction (**not needed if just using pull zone functions**)
135127

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

620612
---
621613

622-
## Video streaming
614+
### Video streaming zone interaction
615+
616+
```php
617+
require __DIR__ . '/vendor/autoload.php';
618+
619+
use Corbpie\BunnyCdn\BunnyAPIStream;
620+
621+
$bunny = new BunnyAPIStream();
622+
```
623+
---
623624

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

dns_example.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
22
require __DIR__ . '/vendor/autoload.php';
33

4-
use Corbpie\BunnyCdn\BunnyAPI;
4+
use Corbpie\BunnyCdn\BunnyAPIDNS;
55

6-
$bunny = new BunnyAPI();
6+
$bunny = new BunnyAPIDNS();
77

88
//Returns all DNS zones
99
$bunny->getDNSZones();

example.php

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
22
require __DIR__ . '/vendor/autoload.php';
33

4-
use Corbpie\BunnyCdn\BunnyAPI;
4+
use Corbpie\BunnyCdn\BunnyAPIPull;
55

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

99
/*
@@ -12,13 +12,13 @@
1212
*
1313
*/
1414

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

1818
//Examples using pull zone id: 1337
1919

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

2323
//List hostnames for a pull zone
2424
$bunny->pullZoneHostnames(1337);
@@ -78,6 +78,9 @@
7878
*
7979
*/
8080

81+
use Corbpie\BunnyCdn\BunnyAPIStorage;
82+
83+
$bunny = new BunnyAPIStorage();
8184
//View all storage zones for account
8285
echo $bunny->listStorageZones();//Returns data for all Storage zones on account
8386

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

93+
//Check if a folder (path) exists by using its path
94+
$bunny->folderExists('pets');//Returns true if exists
95+
9096
//Create a new folder
9197
echo $bunny->createFolder('pets');//Creates a new folder called pets
9298

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

113-
114119
/*
115120
*
116121
* Video stream API examples
117122
*
118123
*/
119124

125+
use Corbpie\BunnyCdn\BunnyAPIStream;
126+
127+
$bunny = new BunnyAPIStream();
128+
120129
//List collections for library 1234
121130
echo json_encode($bunny->getStreamCollections(1234));
122131

0 commit comments

Comments
 (0)