itsemon245/laravel-bunny
Composer 安装命令:
composer require itsemon245/laravel-bunny
包简介
A simple wrapper arround bunny cdn laravel filesystem adapter
README 文档
README
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';
itsemon245/laravel-bunny 适用场景与选型建议
itsemon245/laravel-bunny 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.42k 次下载、GitHub Stars 达 6, 最近一次更新时间为 2025 年 01 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 itsemon245/laravel-bunny 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 itsemon245/laravel-bunny 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 2.42k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-01-04