PHP code example of itsemon245 / laravel-bunny

1. Go to this page and download the library: Download itsemon245/laravel-bunny library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

itsemon245 / laravel-bunny example snippets


  'bunny'=>[
      'driver' => 'bunny',
      'storage_zone' => env('BUNNYCDN_STORAGE_ZONE', 'my-storage-zone'),# Name of your storage zone
      'pull_zone' => env('BUNNYCDN_PULL_ZONE', 'https://random.b-cdn.net'),#Pull Zone URL
      'api_key' => env('BUNNYCDN_API_KEY'), # Use one of the password found in the storage zone.
      'region' => env('BUNNYCDN_REGION', \Itsemon245\LaravelBunny\Region::DEFAULT),
      'root'=> 'my-files',#Optional, all files will be stored under this directory if specified
  ]

//Storing file
Storage::disk('bunny')->put('new-file.txt', 'hello-world');

//Retrieving url
$url = Storage::disk('bunny')->url('new-file.txt');# https://random.b-cdn.net/my-files/new-file.txt

//Storing file
Storage::put('new-file.txt', 'hello-world');

//Retrieving url
$url = Storage::url('new-file.txt');# https://random.b-cdn.net/my-files/new-file.txt

use Itsemon245\LaravelBunny\Region;

# Default
Region::DEFAULT = 'de';

# Europe
Region::FALKENSTEIN = 'de';
Region::STOCKHOLM = 'se';

# United Kingdom
Region::UNITED_KINGDOM = 'uk';

# USA
Region::NEW_YORK = 'ny';
Region::LOS_ANGELAS = 'la';

# SEA
Region::SINGAPORE = 'sg';

# Oceania
Region::SYDNEY = 'syd';

# Africa
Region::JOHANNESBURG = 'jh';

# South America
Region::BRAZIL = 'br';