Skip to content

Commit

Permalink
Merge pull request #19 from cp6/Development
Browse files Browse the repository at this point in the history
Development v1.8
  • Loading branch information
cp6 authored Aug 18, 2022
2 parents 8fb7a9f + e7906c2 commit 017f278
Show file tree
Hide file tree
Showing 5 changed files with 429 additions and 100 deletions.
39 changes: 34 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,44 @@
# BunnyCDN API Class

The most comprehensive, feature packed and easy to use PHP class for [bunny.net](https://bunny.net?ref=qxdxfxutxf) (
BunnyCDN) pull, video streaming and storage zones [API](https://docs.bunny.net/reference/bunnynet-api-overview).
BunnyCDN) pull, video streaming, DNS and storage zones [API](https://docs.bunny.net/reference/bunnynet-api-overview).

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.7-blue.svg)]()
[![Generic badge](https://img.shields.io/badge/PHP-8-purple.svg)]()

**Note video streaming API is seemingly not finalized and changes from time to time**
[![Generic badge](https://img.shields.io/badge/version-1.8-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

### 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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "corbpie/bunny-cdn-api",
"description": "Bunny CDN API class for handling pull and storage zones plus video streaming.",
"description": "Bunny net CDN API class for handling pull zones, video streaming, DNS and storage zones.",
"type": "library",
"license": "MIT",
"minimum-stability": "stable",
Expand Down
63 changes: 63 additions & 0 deletions dns_example.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?php
require __DIR__ . '/vendor/autoload.php';

use Corbpie\BunnyCdn\BunnyAPI;

$bunny = new BunnyAPI();

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

//Returns all single DNS zone details
$bunny->getDNSZone(1234);

//Create a DNS zone with logging enable
$bunny->addDNSZone('zonedomain.com', true);

//Delete DNS zone (1234 is the DNS zone id)
$bunny->deleteDNSZone(1234);

//Returns DNS zone statistics
$bunny->getDNSZoneStatistics(1234);

//Update DNS nameservers
$bunny->updateDNSZoneNameservers(12345, true, 'nameserverone.com', 'nameservertwo.com');

//Update DNS SOA email
$bunny->updateDNSZoneSoaEmail(12345, '[email protected]');

//Add DNS A record
$bunny->addDNSRecordA(12345, 'thehost.com', '199.99.99.99');

//Add DNS AAAA record
$bunny->addDNSRecordAAAA(12345, 'thehost.com', '2001:0db8:85a3:0000:0000:8a2e:0370:7334');

//Add DNS CNAME record
$bunny->addDNSRecordCNAME(12345, 'thehost.com', 'sometarget.com');

//Add DNS MX record (priority of 600)
$bunny->addDNSRecordMX(12345, 'thehost.com', 'mailserver.com', 600);

//Add DNS TXT record
$bunny->addDNSRecordTXT(12345, 'thehost.com', 'the TXT content');

//Add DNS NS record
$bunny->addDNSRecordNS(12345, 'thehost.com', 'targetns.com');

//Add DNS redirect record
$bunny->addDNSRecordRedirect(12345, 'thehost.com', 'theurl.com');

//Update DNS A record (9876 is the DNS record id)
$bunny->updateDNSRecordA(12345, 9876,'diffdomain.com', '162.55.44.12');

//Update DNS AAAA record (9876 is the DNS record id)
$bunny->updateDNSRecordA(12345, 9876,'thehost.com', '12001:0db8:85a3:0000:0000:8a2e:0370:6225');

//Disable a DNS record
$bunny->disableDNSRecord(12345, 9876);

//Enable a DNS record
$bunny->enableDNSRecord(12345, 9876);

//Delete DNS record
$bunny->deleteDNSRecord(12345, 9876);
2 changes: 1 addition & 1 deletion example.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Corbpie\BunnyCdn\BunnyAPI;

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

/*
*
Expand Down
Loading

0 comments on commit 017f278

Please sign in to comment.