Skip to content

Commit 517b647

Browse files
committed
v2
1 parent 644327d commit 517b647

File tree

3 files changed

+25
-14
lines changed

3 files changed

+25
-14
lines changed

README.md

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# Requirement
66

7-
- PHP >= 5.5.9
7+
- PHP >= 7.4
88

99
# Installation
1010

@@ -15,6 +15,9 @@ $ composer require "overtrue/laravel-filesystem-cos" -vvv
1515
# Configuration
1616

1717
1. Add a new disk to your `config/filesystems.php` config:
18+
19+
🚨 当前为 v2 版本,v2 和 v1 在配置写法上有差异,升级请注意。
20+
1821
```php
1922
<?php
2023

@@ -23,24 +26,30 @@ $ composer require "overtrue/laravel-filesystem-cos" -vvv
2326
//...
2427
'cos' => [
2528
'driver' => 'cos',
26-
'region' => env('COS_REGION', 'ap-guangzhou'),
27-
'credentials' => [
28-
'appId' => env('COS_APP_ID'),
29-
'secretId' => env('COS_SECRET_ID'),
30-
'secretKey' => env('COS_SECRET_KEY'),
29+
30+
'app_id' => env('COS_APP_ID'),
31+
'secret_id' => env('COS_SECRET_ID'),
32+
'secret_key' => env('COS_SECRET_KEY'),
33+
'region' => env('COS_REGION', 'ap-guangzhou'),
34+
35+
'bucket' => env('COS_BUCKET'),
36+
'cdn' => env('COS_CDN'),
37+
'signed_url' => false,
38+
39+
'guzzle' => [
40+
'timeout' => env('COS_TIMEOUT', 60),
41+
'connect_timeout' => env('COS_CONNECT_TIMEOUT', 60),
3142
],
32-
'timeout' => env('COS_TIMEOUT', 60),
33-
'connect_timeout' => env('COS_CONNECT_TIMEOUT', 60),
34-
'bucket' => env('COS_BUCKET'),
35-
'cdn' => env('COS_CDN'),
36-
'scheme' => env('COS_SCHEME', 'https'),
37-
'read_from_cdn' => env('COS_READ_FROM_CDN', false),
3843
],
3944
//...
4045
]
4146
];
4247
```
4348

49+
> 🚨 请注意:example-1230000001.cos.ap-guangzhou.mycloud.com
50+
>
51+
> 其中:bucket: example, app_id: 1230000001, region: ap-guangzhou
52+
4453
# Usage
4554

4655
```php

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
"name": "overtrue/laravel-filesystem-cos",
33
"description": "A Cos storage filesystem for Laravel.",
44
"require": {
5-
"php": ">=5.5.9",
5+
"php": ">=7.4",
66
"league/flysystem": "^1.0",
7-
"overtrue/flysystem-cos": "^2.0.0"
7+
"overtrue/flysystem-cos": "^3.0.0"
88
},
99
"autoload": {
1010
"psr-4": {

src/CosStorageServiceProvider.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Illuminate\Support\ServiceProvider;
1414
use League\Flysystem\Filesystem;
1515
use Overtrue\Flysystem\Cos\CosAdapter;
16+
use Overtrue\Flysystem\Cos\Plugins\FileSignedUrl;
1617
use Overtrue\Flysystem\Cos\Plugins\FileUrl;
1718

1819
/**
@@ -30,6 +31,7 @@ public function boot()
3031

3132
$filesystem = new Filesystem($adapter);
3233
$filesystem->addPlugin(new FileUrl());
34+
$filesystem->addPlugin(new FileSignedUrl());
3335

3436
return $filesystem;
3537
});

0 commit comments

Comments
 (0)