Download the PHP package luckydate2021/flysystem-us3 without Composer

On this page you can find all versions of the php package luckydate2021/flysystem-us3. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package 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,修改增加

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

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

----- class -----

/**

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->setHandler(new CoroutineHandler());

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

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

All versions of flysystem-us3 with dependencies

PHP Build Version
Package Version
Requires league/flysystem Version ^1.0
ext-json Version *
guzzlehttp/guzzle Version ^7.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package luckydate2021/flysystem-us3 contains the following files

Loading the files please wait ....