goodgay/huaweiobs
Composer 安装命令:
composer require goodgay/huaweiobs
包简介
Object Storage Service (OBS) provides massive, secure, highly reliable, and low-cost data storage capabilities, allowing users to store data of any type and size. It is suitable for various data storage scenarios such as enterprise backup/archiving, video on demand, and video surveillance.
README 文档
README
An easy way to use the official php sdk client in your Laravel or Lumen applications.
- Installation and Configuration
- Usage
- Advanced Usage
- Bugs, Suggestions and Support
- Copyright and License
Installation and Configuration
Install the current version of the goodgay/huaweiobs package via composer:
composer require goodgay/huaweiobs
Laravel
The package's service provider will automatically register its service provider.
Publish the configuration file:
php artisan vendor:publish --provider="Goodgay\HuaweiOBS\HWOBSServiceProvider"
Alternative configuration method via .env file
After you publish the configuration file as suggested above, you may configure OBS
by adding the following to your application's .env file (with appropriate values):
HWOBS_ACCESS_KEY_ID=5RXYW9YKK HWOBS_SECRET_ACCESS_KEY=NBHXP7UEBqNu HWOBS_DEFAULT_REGION=region HWOBS_BUCKET=test HWOBS_URL= HWOBS_ENDPOINT=https://obs.cn-south-1.myhuaweicloud.com
Lumen
If you work with Lumen, please register the service provider and configuration in bootstrap/app.php:
$app->register(Goodgay\HuaweiOBS\HWOBSServiceProvider::class); $app->configure('hwobs');
Manually copy the configuration file to your application.
Usage
The HWobs facade is just an entry point into the php-obs sdk,
so previously you might have used:
use ObsV3\ObsClient; $obsClient = ObsClient::factory ( [ 'key' => $ak, 'secret' => $sk, 'endpoint' => $endpoint, 'socket_timeout' => 30, 'connect_timeout' => 10 ] ); $resp = $obsClient -> listObjects(['Bucket' => $bucketName]); foreach ( $resp ['Contents'] as $content ) { printf("\t%s etag[%s]\n", $content ['Key'], $content ['ETag']); } printf("\n");
You can now replace those last two lines with simply:
use Goodgay\HuaweiOBS\HWobs; $return = HWobs::all(); //or $return = HWobs::obs()->listObjects(['Bucket' => $bucketName]);
Lumen users who wish to use Facades can do so by editing the
bootstrap/app.php file to include the following:
$app->withFacades(true,[ Goodgay\HuaweiOBS\HWobs::class => 'Hwobs' ]);
// 文件系统的配置文件位于 config/filesystems.php 'hwobs' => [ 'driver' => 'hwobs', 'key' => env('HWOBS_ACCESS_KEY_ID',''), 'secret' => env('HWOBS_SECRET_ACCESS_KEY',''), 'region' => env('HWOBS_DEFAULT_REGION',''), 'bucket' => env('HWOBS_BUCKET',''), 'url' => env('HWOBS_URL',''), 'endpoint' => env('HWOBS_ENDPOINT',''), 'exceptionResponseMode' => false, ], Storage::disk('hwobs')->put('file.txt', 'Contents');
Advanced Usage
Because the package is a wrapper around the official php-obs sdk, you can do pretty much anything with this package.
To upload:
$resp = HWobs::putText("object-name","some content"); $resp = HWobs::putFile("object-name","./some.txt");
To download:
$resp = HWobs::getText("object-name"); $resp = HWobs::getStream("object-name"); $resp = HWobs::getFile("object-name",'save_path.txt');
To manage objects:
$resp = HWobs::getMetadata("object-name"); $resp = HWobs::delete("object-name"); $resp = HWobs::all(); $resp = HWobs::deleteMulti(['object-name1','object-name2']);
Bugs, Suggestions and Support
Special thanks to Visual Studio Code for their Open Source License Program ... and the excellent IDE, of course!
Please use Github for reporting bugs, and making comments or suggestions.
Copyright and License
laravel-huaweiobs was written by fuzuchang and is released under the MIT License.
Copyright (c) 2020 fuzuchang
goodgay/huaweiobs 适用场景与选型建议
goodgay/huaweiobs 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.56k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2020 年 12 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「OBS」 「huaweiobs」 「esdk-obs-php」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 goodgay/huaweiobs 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 goodgay/huaweiobs 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 goodgay/huaweiobs 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
huawei cloud obs filesystem storage for laravel 5+
huawei obs filesystem storage for laravel 10+
huawei cloud obs filesystem storage for laravel 5+
Alfabank REST API integration
华为云OBS laravel filesystem 适配包
OBS PHP SDK
统计信息
- 总下载量: 3.56k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-12-09