This is a Flysystem adapter for the Aliyun OSS
Installation
composer require larva/laravel-flysystem-oss -vv
for Laravel
This service provider must be registered.
// config/app.php
'providers' => [
'...',
LarvaFlysystemOSSOSSServiceProvider::class,
];
edit the config file: config/filesystems.php
add config
'oss' => [
'driver' => 'oss',
'access_id' => getenv('OSS_ACCESS_ID', 'your id'),
'access_key' => getenv('OSS_ACCESS_KEY', 'your key'),
'bucket' => getenv('OSS_BUCKET', 'your bucket'),
'endpoint' => getenv('OSS_ENDPOINT', 'your endpoint'),//不要用CName,经过测试,官方SDK实现不靠谱
'url' => getenv('OSS_DOMAIN','cdn url'),//CNAME 写这里,可以是域名绑定或者CDN地址 如 https://www.bbb.com 末尾不要斜杠
'prefix' => getenv('OSS_PREFIX', ''), // 这个文件路径前缀,如果上传的内容全部在子目录就填写,否则为空
'security_token' => null,
'proxy' => null,
'timeout' => 3600,
'ssl' => true
],
change default to oss
'default' => 'oss'
Use
see Laravel wiki