承接 itsemon245/laravel-bunny 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

itsemon245/laravel-bunny

最新稳定版本:1.1

Composer 安装命令:

composer require itsemon245/laravel-bunny

包简介

A simple wrapper arround bunny cdn laravel filesystem adapter

README 文档

README

Total Downloads Latest Stable Version License

Laravel Bunny

A simple package that provides a new Storage Driver for bunny CDN using their Filesystem Adapter.

Installation

composer require itsemon245/laravel-bunny

Configuration

Add a new entry for disks in config/filesystems.php using the following example.

  '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
  ]

Note

Don't use the api key from your account settings, it does not work. Use one of the passwords found under Storage Zone > FTP & API Access section

Usage

Usage is pretty simple.

//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

You can also skip calling the disk method everytime if you set FILESYSTEM_DISK to bunny in you .env. Then you can do something simple like.

//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

List of regions

For a full region list, please visit the BunnyCDN API documentation page.

The package also comes with a set of region constants to use

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';

统计信息

  • 总下载量: 792
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-01-04