Skip to content

emresaracoglu/BunnyNet-PHP

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Bunny CDN Logo

BunnyNet API client for PHP

GitHub Repo stars Packagist Downloads Packagist License GitHub tag (latest by date) GitHub Workflow Status

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.

Installation

composer require toshy/bunnynet-php

Quickstart

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

Documentation

Examples for each type of request can be found in the docs directory.

Reference

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.

Notes

  • 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.

Licence

The BunnyNet PHP library is licensed under MIT.

About

Bunny.net CDN API PHP library

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 99.3%
  • Makefile 0.7%