Bunny.net is content delivery platform that truly hops: providing CDN, edge storage, video streaming and image optimizers.
Note: This is a non-official library for the bunny.net API.
composer require toshy/bunnynet-php
require 'vendor/autoload.php';
use ToshY\BunnyNet\BaseRequest;
use ToshY\BunnyNet\EdgeStorageRequest;
use ToshY\BunnyNet\VideoStreamRequest;
use Toshy\BunnyNet\PullZoneLogRequest;
use ToshY\BunnyNet\SecureUrlGenerator;
use ToshY\BunnyNet\ImageOptimizer;
use ToshY\BunnyNet\PricingCalculator;
// Classes for API endpoints.
$bunnyBase = new BaseRequest(
'2cebf4f8-4bff-429f-86f6-bce2c2163d7e89fb0a86-a1b2-463c-a142-11eba8811989'
);
$bunnyEdgeStorage = new EdgeStorageRequest(
'6bf3d93a-5078-4d65-a437-501c44576fe6',
'FS'
);
$bunnyStream = new VideoStreamRequest(
'710d5fb6-d923-43d6-87f8-ea65c09e76dc',
);
$bunnyLog = new PullZoneLogRequest(
'2cebf4f8-4bff-429f-86f6-bce2c2163d7e89fb0a86-a1b2-463c-a142-11eba8811989',
);
// Secure URL with token authentication.
$bunnySecureUrl = new SecureUrlGenerator(
'https://custom-pullzone.b-cdn.net',
'5509f27d-9103-4de6-8370-8bd68db859c9'
);
// Image optimizer
$bunnyImageOptimizer = new ImageOptimizer();
// Pricing calculator for CDN and storage tiers.
$bunnyPricingCalculator = new PricingCalculator();
Examples for each type of request can be found in the docs directory.
- Base
- Edge Storage
- Video Stream
- Pull Zone Log
- Secure Url Generator
- Image Optimizer
- Pricing Calculator
This library was created with the hand of the available bunny.net API docs.
Special thanks to the bunny.net support team for answering my questions regarding the API.
- Tried to keep the naming conventions as close as possible to the original API.
- Tested the majority of the endpoints myself to validate if they are working correctly. If you happen to come across a bug, just submit an issue, and I'll take a look at it.
The BunnyNet PHP library is licensed under MIT.