2017 © Pedro Peláez
 

library cos-sdk-v4

PHP SDK for QCloud COS

image

qcloud/cos-sdk-v4

PHP SDK for QCloud COS

  • Tuesday, March 27, 2018
  • by lewzylu
  • Repository
  • 29 Watchers
  • 44 Stars
  • 2,879 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 24 Forks
  • 2 Open issues
  • 12 Versions
  • 36 % Grown

The README.md

cos-php-sdk:php sdk for 腾讯云对象存储服务

已弃用 - 请升级到 cos-php-sdk-v5

SDK 依赖的 JSON API 已弃用,请直接使用基于 XML API 的 cos-php-sdk-v5,或者参照 指引 升级到新版SDK。, (*1)

安装(直接下载源码集成)

若出现下载失败的问题,请将代码升级到最新的版本(>=v4.3.7)。 直接从github下载源码,然后在您的程序中加载cos-php-sdk-v4/include.php就可以了。, (*2)

修改配置

配置使用数组形式, (*3)

COS所在的区域(region),对应关系如下:, (*4)

地区 region
华南 gz
华中(华东) sh
华北 tj
$config = array(
    'app_id' => '',
    'secret_id' => '',
    'secret_key' => '',
    'region' => 'gz',
    'timeout' => 60
);

示例程序

请参考sample.php, (*5)

// 包含cos-php-sdk-v4/include.php文件
require('cos-php-sdk-v4/include.php');
use QCloud\Cos\Api;

$config = array(
    'app_id' => '',
    'secret_id' => '',
    'secret_key' => '',
    'region' => 'gz',
    'timeout' => 60
);
$cosApi = new Api($config);

// 创建文件夹
$ret = $cosApi->createFolder($bucket, $folder);
var_dump($ret);

// 上传文件
$ret = $cosApi->upload($bucket, $src, $dst);
var_dump($ret);

// 下载文件
$ret = $cosApi->download($bucket, $src, $dst);
var_dump($ret);

// 目录列表
$ret = $cosApi->listFolder($bucket, $folder);
var_dump($ret);

// 更新目录信息
$bizAttr = "";
$ret = $cosApi->updateFolder($bucket, $folder, $bizAttr);
var_dump($ret);

// 更新文件信息
$bizAttr = '';
$authority = 'eWPrivateRPublic';
$customerHeaders = array(
    'Cache-Control' => 'no',
    'Content-Type' => 'application/pdf',
    'Content-Language' => 'ch',
);
$ret = $cosApi->update($bucket, $dst, $bizAttr, $authority, $customerHeaders);
var_dump($ret);

// 查询目录信息
$ret = $cosApi->statFolder($bucket, $folder);
var_dump($ret);

// 查询文件信息
$ret = $cosApi->stat($bucket, $dst);
var_dump($ret);

// 删除文件
$ret = $cosApi->delFile($bucket, $dst);
var_dump($ret);

// 删除目录
$ret = $cosApi->delFolder($bucket, $folder);
var_dump($ret);

// 复制文件
$ret = $cosApi->copyFile($bucket, '/111.txt', '/111_2.txt');
var_dump($ret);

// 移动文件
$ret = $cosApi->moveFile($bucket, '/111.txt', '/111_3.txt');
var_dump($ret);

The Versions

27/03 2018

dev-master

9999999-dev

PHP SDK for QCloud COS

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Avatar yaozongyou
by Avatar ACTom

php cos qcloud

27/03 2018

v4.3.11

4.3.11.0

PHP SDK for QCloud COS

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Avatar yaozongyou
by Avatar ACTom

php cos qcloud

11/03 2018

v4.3.10

4.3.10.0

PHP SDK for QCloud COS

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Avatar yaozongyou
by Avatar ACTom

php cos qcloud

06/02 2018

dev-auth-support

dev-auth-support

PHP SDK for QCloud COS

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Avatar yaozongyou
by Avatar ACTom

php cos qcloud

24/01 2018

v4.3.9

4.3.9.0

PHP SDK for QCloud COS

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Avatar yaozongyou
by Avatar ACTom

php cos qcloud

11/01 2018

v4.3.8

4.3.8.0

PHP SDK for QCloud COS

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Avatar yaozongyou
by Avatar ACTom

php cos qcloud

04/09 2017

v4.3.7

4.3.7.0

PHP SDK for QCloud COS

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Avatar yaozongyou
by Avatar ACTom

php cos qcloud

03/09 2017

v4.3.6

4.3.6.0

PHP SDK for QCloud COS

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Avatar yaozongyou
by Avatar ACTom

php cos qcloud

01/09 2017

v4.3.5

4.3.5.0

PHP SDK for QCloud COS

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Avatar yaozongyou
by Avatar ACTom

php cos qcloud

21/08 2017

v4.3.4

4.3.4.0

PHP SDK for QCloud COS

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Avatar yaozongyou
by Avatar ACTom

php cos qcloud

21/07 2017

v4.3.3

4.3.3.0

PHP SDK for QCloud COS

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Avatar yaozongyou
by Avatar ACTom

php cos qcloud

26/06 2017

v4.3.2

4.3.2.0

PHP SDK for QCloud COS

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Avatar yaozongyou
by Avatar ACTom

php cos qcloud