PHPackages                             libratechie/flysystem-aliyun - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. libratechie/flysystem-aliyun

ActiveLibrary[File &amp; Storage](/categories/file-storage)

libratechie/flysystem-aliyun
============================

Aliyun OSS Flysystem Adapter

v1.0.0(1y ago)1291MITPHPPHP &gt;=8.2

Since Aug 7Pushed 1y ago1 watchersCompare

[ Source](https://github.com/libratechie/flysystem-aliyun)[ Packagist](https://packagist.org/packages/libratechie/flysystem-aliyun)[ RSS](/packages/libratechie-flysystem-aliyun/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (2)Used By (1)

Aliyun OSS Adapter For Flysystem.
=================================

[](#aliyun-oss-adapter-for-flysystem)

[![Version](https://camo.githubusercontent.com/2e94643283547e33fad029f17e373b388fcac35c4652fc2d51377cea8774a9ad/68747470733a2f2f706f7365722e707567782e6f72672f6c696272617465636869652f666c7973797374656d2d616c6979756e2f76657273696f6e)](https://packagist.org/packages/libratechie/flysystem-aliyun)[![Tests](https://github.com/libratechie/flysystem-aliyun/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/libratechie/flysystem-aliyun/actions/workflows/tests.yml)[![License](https://camo.githubusercontent.com/2f5fdebc040e1862dc8f7c881e264414962e0d1726cb9b7b8c3c53c4f0196d3e/68747470733a2f2f706f7365722e707567782e6f72672f6c696272617465636869652f666c7973797374656d2d616c6979756e2f6c6963656e7365)](https://packagist.org/packages/libratechie/flysystem-aliyun)

A Flysystem adapter for Aliyun OSS.

Requirements
------------

[](#requirements)

- `PHP` &gt;= 8.2
- `league/flysystem` ^3.28
- `aliyuncs/oss-sdk-php` ^2.7

Installation
------------

[](#installation)

You can install the package via Composer:

```
composer require libratechie/flysystem-aliyun
```

Configuration
-------------

[](#configuration)

To use the Aliyun adapter, you need to configure it with your Aliyun OSS credentials and settings.

```
use League\Flysystem\Filesystem;
use Libratechie\Flysystem\Aliyun\AliyunAdapter;

$accessKeyId = 'your-access-id';
$accessKeySecret = 'your-access-key';
$bucket = 'your-bucket-name';
$endpoint = 'your-endpoint'; // e.g., oss-cn-guangzhou.aliyuncs.com

$adapter = new AliyunAdapter($accessKeyId, $accessKeySecret, $endpoint, $bucket);

$config = [
    'public_url' => 'your-public-url',
    // e.g., https://your-bucket-name.oss-cn-guangzhou.aliyuncs.com
];
$filesystem = new Filesystem($adapter, $config);
```

Usage
-----

[](#usage)

Here are some examples of how to use the filesystem with the Aliyun adapter:

### Checking

[](#checking)

```
// Checking if a File Exists
$filesystem->fileExists('path/to/file.txt');

// Checking if a Directory Exists
$filesystem->directoryExists('path/to');

// Checking if a File or Folder Exists
$filesystem->directoryExists('path/to/file.txt');
```

### Write

[](#write)

```
// Writing a File
$filesystem->write('path/to/file.txt', 'contents');

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

// Create a directory
$filesystem->createDirectory('path/to/directory');

// Move a file
$filesystem->rename('path/to/file.txt', 'new/path/to/file.txt');

// Copy a file
$filesystem->copy('path/to/file.txt', 'new/path/to/file.txt');
```

### Visibility

[](#visibility)

```
// Set the visibility of a file to 'public'
$filesystem->setVisibility('path/to/file.txt', 'public');

// Get the visibility of a file
// default: Inherits Bucket permissions. The read/write permissions of individual files are determined by the Bucket's read/write permissions.
// private: Private. All access operations to the file require authentication.
// public-read: Public read. Write operations require authentication, but the file can be read anonymously.
// public-read-write: Public read/write. Anyone (including anonymous visitors) can read and write the file.
$visibility = $filesystem->visibility('path/to/file.txt');
```

### Read

[](#read)

```
// Listing Contents of a Directory
$contents = $filesystem->listContents('path/to/directory', true);
foreach ($contents as $object) {
    echo $object['type'] . ': ' . $object['path'] . PHP_EOL;
}

// Reading a File
$contents = $filesystem->read('path/to/file.txt');

// Get the last modified time of a file
$lastModified = $filesystem->lastModified('path/to/file.txt');

// Get the file size
$fileSize = $filesystem->fileSize('path/to/file.txt');

// Get the mime type of file
$mimeType = $filesystem->mimeType('path/to/file.txt');

// Assuming 'public_url' is configured in the $config array
// Generate a public URL for a file
$publicUrl = $this->filesystem->publicUrl($path);

// Sign URL with specified expiration time in seconds and HTTP method.
// The signed URL could be used to access the object directly.
$expiresAt = new DateTimeImmutable('+1 hour');
$privateUrl = $this->filesystem->temporaryUrl($path, $expiresAt);
```

### Delete

[](#delete)

```
// Deleting a File
$filesystem->delete('path/to/file.txt');

// Deleting a Directory
$filesystem->deleteDirectory('path/to');
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

640d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3fa85c5a3c02014f51ff2f57c9f5f1b9e230a6400422a231e200271726fa0584?d=identicon)[libratechie](/maintainers/libratechie)

---

Top Contributors

[![libratechie](https://avatars.githubusercontent.com/u/23713970?v=4)](https://github.com/libratechie "libratechie (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/libratechie-flysystem-aliyun/health.svg)

```
[![Health](https://phpackages.com/badges/libratechie-flysystem-aliyun/health.svg)](https://phpackages.com/packages/libratechie-flysystem-aliyun)
```

###  Alternatives

[league/flysystem-aws-s3-v3

AWS S3 filesystem adapter for Flysystem.

1.6k263.6M787](/packages/league-flysystem-aws-s3-v3)[unisharp/laravel-filemanager

A file upload/editor intended for use with Laravel 5 to 10 and CKEditor / TinyMCE

2.2k3.3M73](/packages/unisharp-laravel-filemanager)[league/flysystem-sftp-v3

SFTP filesystem adapter for Flysystem.

6129.6M91](/packages/league-flysystem-sftp-v3)[iidestiny/flysystem-oss

Flysystem adapter for the Oss storage.

95607.5k25](/packages/iidestiny-flysystem-oss)[yii2-starter-kit/yii2-file-kit

Yii2 file upload and storage kit

151216.8k6](/packages/yii2-starter-kit-yii2-file-kit)[xxtime/flysystem-aliyun-oss

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

51505.3k28](/packages/xxtime-flysystem-aliyun-oss)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
