1 Star 0 Fork 0

wcyxtt/wcy-aliyun-oss

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

Aliyun OSS Adapter For Flysystem.

Latest Stable Version Build Status Total Downloads License Author Code Climate

AliYun OSS Storage adapter for flysystem - a PHP filesystem abstraction.

Installation

composer require xxtime/flysystem-aliyun-oss

Logs

1.3.0
  1. some args name changed
  2. default region oss-cn-hangzhou

Usage

use League\Flysystem\Filesystem;
use Xxtime\Flysystem\Aliyun\OssAdapter;

$aliyun = new OssAdapter([
    'accessId'       => '<aliyun access id>',
    'accessSecret'   => '<aliyun access secret>',
    'bucket'         => '<bucket name>',
    'endpoint'       => '<endpoint address>',
    // 'timeout'        => 3600,
    // 'connectTimeout' => 10,
    // 'isCName'        => false,
    // 'token'          => '',
]);
$filesystem = new Filesystem($aliyun);


// Write Files
$filesystem->write('path/to/file.txt', 'contents');
// get RAW data from aliYun OSS
$raw = $aliyun->supports->getFlashData();

// Write Use writeStream
$stream = fopen('local/path/to/file.txt', 'r+');
$result = $filesystem->writeStream('path/to/file.txt', $stream);
if (is_resource($stream)) {
    fclose($stream);
}

// Update Files
$filesystem->update('path/to/file.txt', 'new contents');

// Check if a file exists
$exists = $filesystem->has('path/to/file.txt');

// Read Files
$contents = $filesystem->read('path/to/file.txt');

// Delete Files
$filesystem->delete('path/to/file.txt');

// Rename Files
$filesystem->rename('filename.txt', 'newname.txt');

// Copy Files
$filesystem->copy('filename.txt', 'duplicate.txt');


// list the contents (not support recursive now)
$filesystem->listContents('path', false);
// 说明:此方法返回从阿里云接口返回的原生数据,仅可调用一次
// DESC: this function return AliYun RAW data
$raw = $aliyun->supports->getFlashData();

Document

  1. Region And Endpoint Table
  2. Aliyun OSS PHP SDK Document

Reference

http://flysystem.thephpleague.com/api/
https://github.com/thephpleague/flysystem

空文件

简介

flysystem-aliyun-oss 展开 收起
PHP
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/wangchunyi/wcy-aliyun-oss.git
git@gitee.com:wangchunyi/wcy-aliyun-oss.git
wangchunyi
wcy-aliyun-oss
wcy-aliyun-oss
master

搜索帮助