2 Star 0 Fork 0

悠悠山雨 / aliyun-oss-thinkphp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Aliyun-oss-filesystem for ThinkPHP

Latest Stable Version License Build Status Scrutinizer Code Quality Code Coverage

扩展借鉴了一些优秀的代码,综合各方,同时做了更多优化,将会添加更多完善的接口和插件,打造ThinkPHP最好的OSS Filesystem扩展

运行环境

  • PHP 7.0+
  • cURL extension
  • ThinkPHP 6.0+

安装方法

  1. 如果您通过composer管理您的项目依赖,可以在你的项目根目录运行:

     $ composer require alphasnow/aliyun-oss-thinkphp

    或者在你的composer.json中声明依赖:

     "require": {
         "alphasnow/aliyun-oss-thinkphp": "~1.0"
     }
  2. 修改环境文件.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);

https://www.kancloud.cn/manual/thinkphp6_0/1037639

文件写入

use think\facade\Filesystem;
$filesystem = Filesystem::disk('aliyun');

$filesystem->write('prefix/path/file.txt',file_get_contents('/local/path/file.txt'));

阿里云OSS文档

License

See LICENSE.

The MIT License (MIT) Copyright (c) 2016 AlphaSnow Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

打造ThinkPHP最好的OSS Storage扩展 展开 收起
PHP
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/shanyu/aliyun-oss-thinkphp.git
git@gitee.com:shanyu/aliyun-oss-thinkphp.git
shanyu
aliyun-oss-thinkphp
aliyun-oss-thinkphp
master

搜索帮助