larva / laravel-flysystem-oss
This is a Flysystem adapter for the Aliyun OSS.
Installs: 2 419
Dependents: 1
Suggesters: 0
Security: 0
Stars: 6
Watchers: 1
Forks: 1
Open Issues: 1
Requires
- php: ^8.0.2
- laravel/framework: ^9.40|^10.0
- larva/flysystem-oss: ^1.0
- league/flysystem: ^3.0
Requires (Dev)
README
适用于 Laravel 的阿里云 OSS 适配器,完整支持阿里云 OSS 所有方法和操作。
安装
composer require larva/laravel-flysystem-oss -vv
修改配置文件: config/filesystems.php
添加一个磁盘配置
'oss' => [ 'driver' => 'oss', 'access_id' => env('OSS_ACCESS_ID', 'your id'), 'access_key' => env('OSS_ACCESS_KEY', 'your key'), 'bucket' => env('OSS_BUCKET', 'your bucket'), 'endpoint' => env('OSS_ENDPOINT', 'your endpoint'),//不要用CName,经过测试,官方SDK实现不靠谱 'url' => env('OSS_URL','cdn url'),//CNAME 写这里,可以是域名绑定或者CDN地址 如 https://www.bbb.com 末尾不要斜杠 'root' => env('OSS_ROOT', ''), // 这个文件路径前缀,如果上传的内容全部在子目录就填写,否则为空 'security_token' => null, 'proxy' => null, 'timeout' => 3600, 'ssl' => true ],
修改默认存储驱动
'default' => 'oss'
使用
参见 Laravel wiki