xxtime/flysystem-aliyun-oss

AliYun OSS adapter for flysystem. Support PHP8. aliyuncs/oss-sdk-php ~2.6

Maintainers

๐Ÿ‘ zlab

Package info

github.com/xxtime/flysystem-aliyun-oss

Wiki

pkg:composer/xxtime/flysystem-aliyun-oss

Statistics

Installs: 523โ€‰450

Dependents: 33

Suggesters: 6

Stars: 51

Open Issues: 3

1.7.1 2023-12-11 08:40 UTC

Requires

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT d23dff13c1df594db56214ccbbf8240b9e189cb2

  • Joe <joe.woop@xxtime.com>

Flysystemaliyun-ossflysystem-aliyun-oss

This package is auto-updated.

Last update: 2026-06-11 13:48:39 UTC


README

๐Ÿ‘ 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
1.7.0
  1. support flysystem v3
  2. support oss-sdk-php 2.6
  3. support PHP8

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+');
$filesystem->writeStream('path/to/file.txt', $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