Skip to content

Commit 6264619

Browse files
committed
Added Plugins.
1 parent d4e72f0 commit 6264619

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,16 @@ $disk->move('old/file1.jpg', 'new/file1.jpg');
6363

6464
// get file contents
6565
$contents = $disk->read('folder/my_file.txt');
66+
67+
// fetch file
68+
$file = $disk->fetch('folder/my_file.txt');
69+
70+
// get file urk
71+
$url = $disk->getUrl('folder/my_file.txt');
72+
73+
// get file upload token
74+
$token = $disk->getUploadToken('folder/my_file.txt');
75+
$token = $disk->getUploadToken('folder/my_file.txt', 3600);
6676
```
6777

6878
[Full API documentation.](http://flysystem.thephpleague.com/api/)

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"require": {
55
"php": ">=5.5.9",
66
"league/flysystem": "^1.0",
7-
"overtrue/flysystem-qiniu": "~0.0.2"
7+
"overtrue/flysystem-qiniu": "^1.0"
88
},
99
"autoload": {
1010
"psr-4": {

src/QiniuStorageServiceProvider.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
use Illuminate\Support\Facades\Storage;
1313
use Illuminate\Support\ServiceProvider;
1414
use League\Flysystem\Filesystem;
15+
use Overtrue\Flysystem\Qiniu\Plugins\FetchFile;
16+
use Overtrue\Flysystem\Qiniu\Plugins\FileUrl;
17+
use Overtrue\Flysystem\Qiniu\Plugins\UploadToken;
1518
use Overtrue\Flysystem\Qiniu\QiniuAdapter;
1619

1720
class QiniuStorageServiceProvider extends ServiceProvider
@@ -27,7 +30,13 @@ public function boot()
2730
$config['bucket'], $config['domain']
2831
);
2932

30-
return new Filesystem($adapter);
33+
$flysystem = new Filesystem($adapter);
34+
35+
$flysystem->addPlugin(new FetchFile());
36+
$flysystem->addPlugin(new UploadToken());
37+
$flysystem->addPlugin(new FileUrl());
38+
39+
return $flysystem;
3140
});
3241
}
3342

0 commit comments

Comments
 (0)