illusionist/flysystem-aliyun-oss
Composer 安装命令:
composer require illusionist/flysystem-aliyun-oss
包简介
Flysystem adapter for the Aliyun OSS SDK
README 文档
README
Flysystem adapter for the Aliyun OSS SDK
English | 中文
Advantages
- Support Laravel & Lumen
- Compared with xxtime/flysystem-aliyun-oss, it is more in line with the flysystem interface specification. Because the flysystem interface suggests that the return value is array or bool, but xxtime/flysystem-aliyun-oss is not very strict about exception handling.
- Compared to apollopy/flysystem-aliyun-oss <= 1.2.0 supports visibility get/set.
- Support Dynamically call OSS SDK methods.
ps: The comparison of similar projects is only to highlight the differences. In fact, they are all very good.
Installation
Install via composer
Run the following command to pull in the latest version:
composer require illusionist/flysystem-aliyun-oss
Laravel Install
If your laravel version <=5.4, Add the service provider to the providers array in the config/app.php config file as follows:
'providers' => [ ... Illusionist\Flysystem\Aliyun\OssServiceProvider::class, ]
Lumen Install
Add the following snippet to the bootstrap/app.php file under the providers section as follows:
... // Add this line $app->register(Illusionist\Flysystem\Aliyun\OssServiceProvider::class);
Config for Laravel/Lumen
Add the adapter config to the disks array in the config/filesystems.php config file as follows:
'disks' => [ ... 'aliyun-oss' => [ 'driver' => 'aliyun-oss', /** * The AccessKeyId from OSS or STS. */ 'key' => '<your AccessKeyId>', /** * The AccessKeySecret from OSS or STS */ 'secret' => '<your AccessKeySecret>', /** * The domain name of the datacenter. * * @example: oss-cn-hangzhou.aliyuncs.com */ 'endpoint' => '<endpoint address>', /** * The bucket name for the OSS. */ 'bucket' => '<bucket name>', /** * The security token from STS. */ 'token' => null, /** * If this is the CName and binded in the bucket. * * Values: true or false */ 'cname' => false, /** * Path prefix */ 'prefix' => '', /** * Request header options. * * @example [x-oss-server-side-encryption => 'KMS'] */ 'options' => [] ] ]
Usage
Basic
Please refer to filesystem-api.
use Illusionist\Flysystem\Aliyun\OssAdapter; use League\Flysystem\Filesystem; use OSS\OssClient; $client = new OssClient( '<your AccessKeyId>', '<your AccessKeySecret>', '<endpoint address>' ); $adapter = new OssAdapter($client, '<bucket name>', 'optional-prefix', 'optional-options'); $filesystem = new Filesystem($adapter); $filesystem->has('file.txt'); // Dynamic call SDK method. $adapter->setTimeout(30); $filesystem->getAdapter()->setTimeout(30);
Laravel/Lumen
Please refer to filesystem
use Illuminate\Support\Facades\Storage; Storage::disk('aliyun-oss')->get('path'); // Dynamic call SDK method. Storage::disk('aliyun-oss')->getAdapter()->setTimeout(30);
illusionist/flysystem-aliyun-oss 适用场景与选型建议
illusionist/flysystem-aliyun-oss 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.28k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2022 年 02 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「filesystem」 「laravel」 「lumen」 「Aliyun OSS」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 illusionist/flysystem-aliyun-oss 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 illusionist/flysystem-aliyun-oss 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 illusionist/flysystem-aliyun-oss 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A SDK for working with B2 cloud storage.
A PHP class providing static methods for reading, writing, copying, moving, and deleting files and directories, MIME type detection, image size detection, and file permission management
Testing Suite For Lumen like Laravel does.
The flysystem adapter for yandex disk rest api.
A sleek PHP wrapper around rclone with Laravel-style fluent API syntax
Stackdriver handler for Monolog (codeinternetapplications/monolog-stackdriver Fork).
统计信息
- 总下载量: 1.28k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-02-24