vvk / upyun-filesystem
This is upyun system file for Laravel!
1.0.0
2020-01-20 08:59 UTC
Requires
- php: ^7.2
- league/flysystem: ^1.0.8
- upyun/sdk: ^3.0
This package is auto-updated.
Last update: 2024-11-20 13:11:59 UTC
README
环境要求
- php >= 7.2
安装
通过 cpomoser
命令安装:
$ composer require vvk/upyun-filesystem
使用
- 在
config/filesystems.php
中添加又又拍云驱动相关账号配置:
'disks' => [ ... 'upyun' => [ 'driver' => 'upyun', 'service' => env('UPYUN_SERVICE', ''), 'operator' => env('UPYUN_OPERATOR', ''), 'password' => env('UPYUN_PASSWORD', ''), 'domain' => env('UPYUN_DOMAIND', ''), ], ],
- 目前支持的方法有:
Storage::disk('upyun')->has('a.png'); Storage::disk('upyun')->get('a.png'); Storage::disk('upyun')->write('a.png', file_get_contents('a.png')); Storage::disk('upyun')->writeStream('a.png', fopen('path/a.png', 'r')); Storage::disk('upyun')->update('a.png', file_get_contents('a.png')); Storage::disk('upyun')->updateStram('a.png', file_get_contents('a.png')); Storage::disk('upyun')->rename('old.png', 'new.png'); Storage::disk('upyun')->copy('a.png', 'new.png'); Storage::disk('upyun')->delete('a.png'); Storage::disk('upyun')->deleteDir('/a');//非空目录不能删除 Storage::disk('upyun')->createDir('/a/b/c'); Storage::disk('upyun')->read('a.png'); Storage::disk('upyun')->readStream('a.png'); Storage::disk('upyun')->listContents('/'); Storage::disk('upyun')->getUrl('/a.png'); Storage::disk('upyun')->getType('/a.png'); Storage::disk('upyun')->getMetadata('/a.png'); Storage::disk('upyun')->getSize('/a.png'); Storage::disk('upyun')->getMimetype('/a.png'); Storage::disk('upyun')->getTimestamp('/a.png');
License
MIT