PHPackages                             luckydate2021/flysystem-us3 - 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. luckydate2021/flysystem-us3

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

luckydate2021/flysystem-us3
===========================

Flysystem adapter for the Ucloud US3 storage.

v1.0.8(3y ago)011MITPHP

Since Sep 9Pushed 3y agoCompare

[ Source](https://github.com/luckydate2021/flysystem-us3)[ Packagist](https://packagist.org/packages/luckydate2021/flysystem-us3)[ RSS](/packages/luckydate2021-flysystem-us3/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)Dependencies (2)Versions (7)Used By (0)

flysystem-us3
=============

[](#flysystem-us3)

Flysystem adapter for the Ucloud US3 storage.

### 使用

[](#使用)

1. 拉取

    composer require luckydate2021/flysystem-us3

    如果提示找不到就还原composer的默认仓库再试。注意只限hyperf(^2.2)使用.

    如果提示 league/flysystem 引用的版本问题，就先指定league/flysystem为^1.0再拉取

    composer require "league/flysystem:^1.0"
2. 按照 hyperf 的手册加入filesystem，和发布

    composer require hyperf/filesystem

    发布

    php bin/hyperf.php vendor:publish hyperf/filesystem
3. 发布后在config下autoload有个file.php，修改增加

    ```
    'us3' => [
    'driver' => \Luckydate2021\Flysystem\Us3\Us3AdapterFactory::class,
    'public_key' => env('US3_PUBLIC_KEY'),
    'secret_key' => env('US3_SECRET_KEY'),
    'bucket' => env('US3_BUCKET'),
    'suffix' => env('US3_SUFFIX'), //eg. ".ufile.ucloud.cn"
    'path_prefix' => '',
    'https' => false,
    ]

    ```
4. 由于第三方flysystem返回writeStream的结果是布尔值，但ucloud错误是json，导致错也是true； 可以创建一个目录例如patch，然后把Filesystem.php复制到目录，删除强制转换的(bool)，直接返回ucloud结果。 然后在composer.json，加入这个文件自动加载。

    备注：ucloud上传成功返回的文件名称，错误的话返回是个json，里面有错误。

```
"autoload": {
        "psr-4": {
            "App\\": "app/"
        },
        "files": [
            "patch/Filesystem.php"
        ]
    },

```

### 示例

[](#示例)

```
use Hyperf\Filesystem\FilesystemFactory;
use Hyperf\Di\Annotation\Inject;

----- class -----

/**
* @Inject()
* @var FilesystemFactory
*/
protected $filesystemFactory;

public function index()
    {
        $file = $this->request->file('avatar');
        if ($file->isValid()) {

            $ext = strtolower($file->getExtension());

            $filePathUrl = rand(1000, 9999) . '.' . $ext;

            try {
                $stream = fopen($file->getRealPath(), 'r+');
                $bucket = $this->filesystemFactory->get('us3');
                $bucket->writeStream($filePathUrl, $stream, ['mime' => 'image/png']); //主要这里的mine要根据文件来传，这里只是示例
                if (is_resource($stream)) {
                    fclose($stream);
                }
               //'注意:如果发现无法上传，则检查key之类的是否正确，还是不知道就改一下拉下来的Us3Adapter.php，把writeStream返回的结果打印下，看ucloud的报错信息';
            } catch (\Exception $e) {
                return '上传失败';
            }

        }

```

### 其他注意

[](#其他注意)

只适用于league/flysystem ^1.1版本。

在Us3Sdk中使用了new CoroutineHandler()，只限hyperf(^2.2)使用。

use Hyperf\\Guzzle\\CoroutineHandler;

$stack-&gt;setHandler(new CoroutineHandler());

一定要传正确的文件类型mime，不然Ucloud默认的是二进制文件 application/octet-stream，容易格式错误。

例如 $bucket-&gt;writeStream($filePathUrl, $stream, \['mime' =&gt; 'image/png'\]);

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90% 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

Every ~111 days

Total

5

Last Release

1305d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/072a5eb61d24d8c58c1822f470fb37f81d6b04873c858a358dcf2e4bc899d296?d=identicon)[luckydate2021](/maintainers/luckydate2021)

---

Top Contributors

[![luckydate2021](https://avatars.githubusercontent.com/u/93175834?v=4)](https://github.com/luckydate2021 "luckydate2021 (18 commits)")[![Enoliu](https://avatars.githubusercontent.com/u/25947382?v=4)](https://github.com/Enoliu "Enoliu (2 commits)")

### Embed Badge

![Health badge](/badges/luckydate2021-flysystem-us3/health.svg)

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

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.2k532.1M2.5k](/packages/aws-aws-sdk-php)[laravel/framework

The Laravel Framework.

34.8k532.1M19.4k](/packages/laravel-framework)[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k496.1k33](/packages/neuron-core-neuron-ai)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3661.2M46](/packages/tencentcloud-tencentcloud-sdk-php)[masbug/flysystem-google-drive-ext

Flysystem adapter for Google Drive with seamless virtual&lt;=&gt;display path translation

2672.0M17](/packages/masbug-flysystem-google-drive-ext)

PHPackages © 2026

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