alphasnow / aliyun-oss-thinkphp
aliyun oss filesystem storage for thinkphp 6
1.1.0
2021-03-29 10:06 UTC
Requires
- php: >=7.1.0
- aliyuncs/aliyun-oss-flysystem: ^1.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16
- mockery/mockery: ~1.0
- phpstan/phpstan: ^0.12.82
- phpunit/phpunit: ~6.0
- topthink/framework: ^6.0
This package is auto-updated.
Last update: 2024-11-29 06:22:41 UTC
README
扩展借鉴了一些优秀的代码,综合各方,同时做了更多优化,将会添加更多完善的接口和插件,打造ThinkPHP最好的OSS Filesystem扩展
运行环境
- PHP 7.0+
- cURL extension
- ThinkPHP 6.0+
安装方法
-
如果您通过composer管理您的项目依赖,可以在你的项目根目录运行:
$ composer require alphasnow/aliyun-oss-thinkphp
或者在你的
composer.json
中声明依赖:"require": { "alphasnow/aliyun-oss-thinkphp": "~1.0" }
-
修改环境文件
.env
ALIYUN_OSS_ACCESS_ID= ALIYUN_OSS_ACCESS_KEY= ALIYUN_OSS_BUCKET= ALIYUN_OSS_ENDPOINT=oss-cn-shanghai.aliyuncs.com ALIYUN_OSS_IS_CNAME=false ALIYUN_OSS_CDN_DOMAIN= ALIYUN_OSS_IS_SSL=false
快速使用
文件上传
use think\facade\Filesystem; $file = request()->file('image'); $savename = Filesystem::disk('aliyun')->putFile( 'image', $file);
文件写入
use think\facade\Filesystem; $filesystem = Filesystem::disk('aliyun'); $filesystem->write('prefix/path/file.txt',file_get_contents('/local/path/file.txt'));
License
See LICENSE.