1
- # Laravel filesystem COS
1
+ # Laravel filesystem COS
2
2
3
3
[ Tencent Cloud COS] ( https://cloud.tencent.com/product/cos ) storage for Laravel based on [ overtrue/flysystem-cos] ( https://github.com/overtrue/flysystem-cos ) .
4
4
5
5
[ ![ Sponsor me] ( https://github.com/overtrue/overtrue/blob/master/sponsor-me-button-s.svg?raw=true )] ( https://github.com/sponsors/overtrue )
6
6
7
7
# Requirement
8
8
9
- - PHP >= 7.4
9
+ - Laravel >= 9.0
10
10
11
11
# Installation
12
12
@@ -18,37 +18,35 @@ $ composer require "overtrue/laravel-filesystem-cos" -vvv
18
18
19
19
1 . Add a new disk to your ` config/filesystems.php ` config:
20
20
21
- 🚨 当前为 v2 版本,v2 和 v1 在配置写法上有差异,升级请注意。
22
-
23
- ``` php
24
- <?php
25
-
26
- return [
27
- 'disks' => [
28
- //...
29
- 'cos' => [
30
- 'driver' => 'cos',
31
-
32
- 'app_id' => env('COS_APP_ID'),
33
- 'secret_id' => env('COS_SECRET_ID'),
34
- 'secret_key' => env('COS_SECRET_KEY'),
35
- 'region' => env('COS_REGION', 'ap-guangzhou'),
36
-
37
- 'bucket' => env('COS_BUCKET'), // 不带数字 app_id 后缀
38
- 'cdn' => env('COS_CDN'),
39
- 'signed_url' => false,
40
-
41
- 'prefix' => env('COS_PATH_PREFIX'), // 全局路径前缀
42
-
43
- 'guzzle' => [
44
- 'timeout' => env('COS_TIMEOUT', 60),
45
- 'connect_timeout' => env('COS_CONNECT_TIMEOUT', 60),
46
- ],
47
- ],
48
- //...
49
- ]
50
- ];
51
- ```
21
+ ``` php
22
+ <?php
23
+
24
+ return [
25
+ 'disks' => [
26
+ //...
27
+ 'cos' => [
28
+ 'driver' => 'cos',
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'), // 不带数字 app_id 后缀
36
+ 'cdn' => env('COS_CDN'),
37
+ 'signed_url' => false,
38
+
39
+ 'prefix' => env('COS_PATH_PREFIX'), // 全局路径前缀
40
+
41
+ 'guzzle' => [
42
+ 'timeout' => env('COS_TIMEOUT', 60),
43
+ 'connect_timeout' => env('COS_CONNECT_TIMEOUT', 60),
44
+ ],
45
+ ],
46
+ //...
47
+ ]
48
+ ];
49
+ ```
52
50
53
51
> 🚨 请注意:example-1230000001.cos.ap-guangzhou.mycloud.com
54
52
>
@@ -77,20 +75,16 @@ $disk->move('old/file1.jpg', 'new/file1.jpg');
77
75
78
76
// get file contents
79
77
$contents = $disk->read('folder/my_file.txt');
80
-
81
- // get file url
82
- $url = $disk->getUrl('folder/my_file.txt');
83
78
```
84
79
85
80
[ Full API documentation.] ( http://flysystem.thephpleague.com/api/ )
86
81
87
- ## :heart : Sponsor me
82
+ ## :heart : Sponsor me
88
83
89
84
[ ![ Sponsor me] ( https://github.com/overtrue/overtrue/blob/master/sponsor-me.svg?raw=true )] ( https://github.com/sponsors/overtrue )
90
85
91
86
如果你喜欢我的项目并想支持它,[ 点击这里 :heart : ] ( https://github.com/sponsors/overtrue )
92
87
93
-
94
88
## Project supported by JetBrains
95
89
96
90
Many thanks to Jetbrains for kindly providing a license for me to work on this and other open-source projects.
@@ -103,7 +97,6 @@ Many thanks to Jetbrains for kindly providing a license for me to work on this a
103
97
>
104
98
> 请关注我的实战课程,我会在此课程中分享一些扩展开发经验 —— [ 《PHP 扩展包实战教程 - 从入门到发布》] ( https://learnku.com/courses/creating-package )
105
99
106
-
107
100
# License
108
101
109
102
MIT
0 commit comments