huojunhao / tencent-oss-adapter
使用腾讯云OSS作为Laravel 5.0+的存储
v0.0.1
2018-05-22 05:51 UTC
Requires
- php: >=5.4.0
- league/flysystem: ~1.0
- qcloud/cos-sdk-v5: >=1.0
Suggests
- laravel/framework: 5.5.*
This package is auto-updated.
Last update: 2024-09-13 16:17:14 UTC
README
<<<<<<< HEAD
将 tencent-oss-adapter 作为 Laravel Storage 使用
模仿 aliyun-oss-adapter阿里云的oss包,为腾讯云编写了oss包
腾讯云OSS SDK: qcloud/cos-sdk-v5
用法
use Storage; //... ## Installation This package can be installed through Composer. ```bash composer require aobozhang/aliyun-oss-adapter
配置
必须注册此服务提供者。
// config/app.php 'providers' => [ ..., Huojunhao\OSS\TencentyunOssFilesystemServiceProvider::class ];
添加配置
// config/filesystem.php.
'tencent_oss' => [
'driver' => 'tencent_oss',
'credentials'=>[
'appId' => env('QCLOUD_APPID'),//开发者访问 COS 服务时拥有的用户维度唯一资源标识,用以标识资源
'secretId' => env('QCLOUD_SECRETID'),//开发者拥有的项目身份识别 ID,用以身份认证
'secretKey' => env('QCLOUD_SECRETKEY')//开发者拥有的项目身份密钥
],
'region' => env('QCLOUD_REGION'),//地区
'bucket' => env('QCLOUD_BUCKET'),//COS 中用于存储数据的容器
],
将默认设置改为oss
'default' => 'tencent_oss';
### 示例
// 添加
Storage::put('marss.jpg', file_get_contents(__DIR__."/mars.jpg"));
// 下载
$contents = Storage::get('marss.jpg');
file_put_contents(__DIR__ . "/testtencent.jpg", $contents);
// 是否存在
$exists = Storage::exists('marss.jpg');
dump($exists);
// 大小(单位为B)
$size = Storage::size('marss.jpg');
dump($size);
// 最新更新时间
$time = Storage::lastModified('marss.jpg');
dump(date("Y-m-d H:i:s",$time));
// 复制
Storage::copy('test/marss.jpg', 'new/marss.jpg');
// 移动
Storage::move('marss.jpg', 'new/test/marss.jpg');
目前只实现了这几个功能,其他的比如列表显示等还没有实现
=======
tencent-oss-adapter
8b1ba242542d3641becbe6cea5e9cbefb78cde4e