2017 © Pedro Peláez
 

library tencent-oss-adapter

Use Tencent oss as Storage for Laravel 5.0+

image

huojunhao/tencent-oss-adapter

Use Tencent oss as Storage for Laravel 5.0+

  • Tuesday, May 22, 2018
  • by huo376230434
  • Repository
  • 1 Watchers
  • 1 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

<<<<<<< HEAD, (*1)

Use tencent-oss-adapter as Laravel Storage

模仿 aliyun-oss-adapter阿里云的oss包写了腾讯云的oss, (*2)

腾讯云的OSS sdk: qcloud/cos-sdk-v5

Usage


use Storage; //... ## Installation This package can be installed through Composer. ```bash composer require aobozhang/aliyun-oss-adapter

Configuration

This service provider must be registered., (*3)

// config/app.php

'providers' => [
    ...,
        Huojunhao\OSS\TencentyunOssFilesystemServiceProvider::class
];

add config:, (*4)

// 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 中用于存储数据的容器
        ],

change default to oss, (*5)

'default' => 'tencent_oss';

demo

// 添加, (*6)

 Storage::put('marss.jpg', file_get_contents(__DIR__."/mars.jpg"));

// 下载, (*7)

 $contents = Storage::get('marss.jpg');
 file_put_contents(__DIR__ . "/testtencent.jpg", $contents);

// 是否存在, (*8)

  $exists   = Storage::exists('marss.jpg');
          dump($exists);

// 大小(单位为B), (*9)

    $size     = Storage::size('marss.jpg');
            dump($size);

// 最新更新时间, (*10)

    $time     = Storage::lastModified('marss.jpg');
    dump(date("Y-m-d H:i:s",$time));

// 复制, (*11)

    Storage::copy('test/marss.jpg', 'new/marss.jpg');

// 移动, (*12)

     Storage::move('marss.jpg', 'new/test/marss.jpg');

目前只实现了这几个功能,其他的比如列表显示等还没有实现, (*13)

=======, (*14)

tencent-oss-adapter

8b1ba242542d3641becbe6cea5e9cbefb78cde4e, (*15)

The Versions

22/05 2018

dev-master

9999999-dev https://github.com/huo376230434

Use Tencent oss as Storage for Laravel 5.0+

  Sources   Download

MIT

The Requires

 

laravel storage oss tencent

22/05 2018

v0.0.1

0.0.1.0 https://github.com/huo376230434

Use Tencent oss as Storage for Laravel 5.0+

  Sources   Download

MIT

The Requires

 

laravel storage oss tencent