https://github.com/alphasnow/aliyun-oss-flysystem
💾 Flysystem adapter for the Aliyun storage.
https://github.com/alphasnow/aliyun-oss-flysystem
aliyun flysystem oss php sdk
Last synced: 11 months ago
JSON representation
💾 Flysystem adapter for the Aliyun storage.
- Host: GitHub
- URL: https://github.com/alphasnow/aliyun-oss-flysystem
- Owner: alphasnow
- License: mit
- Created: 2021-06-09T02:31:01.000Z (about 5 years ago)
- Default Branch: 3.x
- Last Pushed: 2025-06-16T10:14:45.000Z (about 1 year ago)
- Last Synced: 2025-06-16T11:24:37.619Z (about 1 year ago)
- Topics: aliyun, flysystem, oss, php, sdk
- Language: PHP
- Homepage: https://alphasnow.github.io/aliyun-oss-flysystem/
- Size: 137 KB
- Stars: 14
- Watchers: 1
- Forks: 10
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Aliyun OSS Flysystem
💾 Flysystem Adapter for [Aliyun Object Storage Service](https://www.alibabacloud.com/help/en/object-storage-service).
[](https://packagist.org/packages/alphasnow/aliyun-oss-flysystem)
[](https://packagist.org/packages/alphasnow/aliyun-oss-flysystem)
[](https://packagist.org/packages/alphasnow/aliyun-oss-flysystem)
[](https://github.com/alphasnow/aliyun-oss-flysystem/actions/workflows/tests.yml)
[](https://coveralls.io/github/alphasnow/aliyun-oss-flysystem?branch=3)
## Compatibility
| **flysystem** | **aliyun-oss-flysystem** | **readme**
|---|---|---|
| ^3.0 | ^3.0 | [readme](https://github.com/alphasnow/aliyun-oss-flysystem/blob/3.x/README.md) |
| ^2.0 | ^2.0 | [readme](https://github.com/alphasnow/aliyun-oss-flysystem/blob/2.x/README.md) |
| ^1.0 | ^1.0 | [readme](https://github.com/alphasnow/aliyun-oss-flysystem/blob/1.x/README.md) |
| ~1.0.0 | ^0.3 | [readme](https://github.com/alphasnow/aliyun-oss-flysystem/blob/0.x/README.md) |
## Installation
```bash
composer require "alphasnow/aliyun-oss-flysystem"
```
## Usage
### Initialize
```php
use OSS\OssClient;
use AlphaSnow\Flysystem\Aliyun\AliyunFactory;
$config = [
"access_key_id" => "**************", // Required, YourAccessKeyId
"access_key_secret" => "********************", // Required, YourAccessKeySecret
"endpoint" => "oss-cn-shanghai.aliyuncs.com", // Required, Endpoint
"bucket" => "bucket-name", // Required, Bucket
];
$flysystem = (new AliyunFactory())->createFilesystem($config);
$flysystem->write("file.md", "contents");
$flysystem->writeStream("foo.md", fopen("file.md", "r"));
$fileExists = $flysystem->fileExists("foo.md");
$flysystem->copy("foo.md", "baz.md");
$flysystem->move("baz.md", "bar.md");
$flysystem->delete("bar.md");
$has = $flysystem->has("bar.md");
$read = $flysystem->read("file.md");
$readStream = $flysystem->readStream("file.md");
$flysystem->createDirectory("foo/");
$directoryExists = $flysystem->directoryExists("foo/");
$flysystem->deleteDirectory("foo/");
$listContents = $flysystem->listContents("/", true);
$listPaths = [];
foreach ($listContents as $listContent) {
$listPaths[] = $listContent->path();
}
$lastModified = $flysystem->lastModified("file.md");
$fileSize = $flysystem->fileSize("file.md");
$mimeType = $flysystem->mimeType("file.md");
$flysystem->setVisibility("file.md", "private");
$visibility = $flysystem->visibility("file.md");
```
### Options
```php
$flysystem->write("file.md", "contents", [
"options" => ["checkmd5" => false]
]);
$flysystem->write("bar.md", "contents", [
"headers" => ["Content-Disposition" => "attachment;filename=bar.md"]
]);
$flysystem->write("baz.md", "contents", [
"visibility" => "private"
]);
```
## Reference
[https://github.com/thephpleague/flysystem](https://github.com/thephpleague/flysystem)
## License
The MIT License (MIT). Please see [License File](LICENSE) for more information.