PHPackages                             filacare/flysystem-oss - 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. filacare/flysystem-oss

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

filacare/flysystem-oss
======================

Aliyun OSS adapter based on flysystem, Support client side encryption, Compatible Laravel 9|10

v2.0.3(2y ago)2154MITPHPPHP ^8.0.2

Since Aug 11Pushed 2y ago1 watchersCompare

[ Source](https://github.com/filacare/flysystem-oss)[ Packagist](https://packagist.org/packages/filacare/flysystem-oss)[ RSS](/packages/filacare-flysystem-oss/feed)WikiDiscussions main Synced today

READMEChangelog (7)Dependencies (4)Versions (8)Used By (0)

Introduction
------------

[](#introduction)

Flysystem for Aliyun oss, support Laravel 9/10

- CDN or custom domain name
- Bucket switch (at the same endpoint)
- Object ACL
- Custom Aliyun options
- OSS directly and verify
- Compatible with Laravel
- Client side encryption

Require
-------

[](#require)

- PHP 8.0.2+

Install
-------

[](#install)

```
composer require filacare/flysystem-oss
```

Basic Usage
-----------

[](#basic-usage)

```
use League\Flysystem\Filesystem;
use Filacare\Flysystem\Oss\OssAdapter;

$config = [
    'accessKeyId'     => 'yourAccessKeyId',      // required
    'accessKeySecret' => 'yourAccessKeySecret',  // required
    'endpoint'        => 'yourEndpoint',         // required
    'isCName'         => false,
    'securityToken'   => null,
    'bucket'          => 'bucketName',           // required
    'root'            => '',  // Global directory prefix
    'cdnUrl'          => '',  // https://yourdomain.com if use cdn
    'options'         => [],  // Custom oss request header options
    'visibility'      => 'public',
    'encryptionKey'   => ''  // Must be 32 characters or ''
];
$adapter = new OssAdapter($config);
$driver = new Filesystem($adapter);

// use dirver
$driver->writeStream(...);
// use adapter
$adapter->getUrl($path);   // get web visit url
$adapter->bucket($bucket); // switch bucket in same endpoint
$adapter->cdnUrl($cdnUrl); // If you use cdn, don't forget to switch the cdn
// use client
$adapter->getClient()->uploadStream(...);
```

For details, please check:

Laravel
-------

[](#laravel)

1. Add in the disks of the config/filesystems.php configuration file

```
'oss' => [
    'driver'          => 'oss',
    'accessKeyId'     => env('OSS_ACCESS_KEY', ''),  // required
    'accessKeySecret' => env('OSS_SECRET_KEY', ''),  // required
    'endpoint'        => env('OSS_ENDPOINT', ''),    // required
    'isCName'         => env('OSS_IS_CNAME', false),
    'securityToken'   => null,
    'bucket'          => env('OSS_BUCKET', ''),      // required
    'root'            => env('OSS_ROOT', ''),  // Global directory prefix
    'cdnUrl'          => '',  // https://yourdomain.com if use cdn
    'options'         => [],  // Custom oss request header options
    'visibility'      => env('OSS_VISIBILITY', 'public'),
    'encryptionKey'   => '' // Must be 32 characters or ''
],
```

2. Usage in Laravel File

```
use Illuminate\Support\Facades\Storage;
Storage::disk('oss')->put($path, $contents, $options = []);
```

For details, please check

Security Setting (Optional)
---------------------------

[](#security-setting-optional)

> Default object visibility acl is public(Equivalent to public\_read), a default visibility setting can be added, this works without passing any visibility options.

```
'visibility' => 'private' // Optional, default visibility acl
```

or higher priority:

```
$driver->writeStream(string $path, $contents, ['visibility' => 'private']);
Storage::disk('oss')->put($path, $contents, 'private');
```

Override option, the above settings will be invalid.

```
'options' => [
    'x-oss-object-acl' => 'private' // public or private
]
```

SpatieMediaLibrary
------------------

[](#spatiemedialibrary)

If the default policy is private and you want SpatieMediaLibrary to default to public\_read, please add it to remote.extra\_headers in the config/media-library.php file.

```
php artisan vendor:publish --provider="Spatie\MediaLibrary\MediaLibraryServiceProvider" --tag="config"
```

```
'visibility' => 'public',
```

Client side encryption
----------------------

[](#client-side-encryption)

Libsodium Stream encryption. Implemented using generators, high performance.
Upload automatic encryption, download automatic decryption.

> EncryptionKey and chunkSize cannot be changed after use, otherwise they cannot be decrypted. Please decrypt the storage before modifying or keep this option in mind.

```
'encryptionKey'   => '', // Must be 32 characters or ''
'chunkSize'       => '', // Default is 4096
```

Fork
----

[](#fork)

Refactoring based on , thanks to the author for his contribution.

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

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

Every ~6 days

Total

7

Last Release

1017d ago

Major Versions

v1.0.2 → v2.0.02023-08-16

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2804854?v=4)[spman](/maintainers/killjin)[@killjin](https://github.com/killjin)

---

Tags

filesystemFlysystemlaravelcloudencryptionstoragealiyunoss

### Embed Badge

![Health badge](/badges/filacare-flysystem-oss/health.svg)

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

###  Alternatives

[league/flysystem-aws-s3-v3

AWS S3 filesystem adapter for Flysystem.

1.7k285.7M1.0k](/packages/league-flysystem-aws-s3-v3)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[jacobcyl/ali-oss-storage

aliyun oss filesystem storage for laravel 5+

537573.2k7](/packages/jacobcyl-ali-oss-storage)[luoyy/ali-oss-storage

aliyun oss filesystem storage for laravel 10+

1531.0k1](/packages/luoyy-ali-oss-storage)[aobozhang/aliyun-oss-adapter

Use Aliyun oss as Storage for Laravel 5.0+

141.0k](/packages/aobozhang-aliyun-oss-adapter)

PHPackages © 2026

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