PHPackages                             houxiaobei/qcloud-cos-v4 - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. houxiaobei/qcloud-cos-v4

ActiveLibrary[File &amp; Storage](/categories/file-storage)

houxiaobei/qcloud-cos-v4
========================

PHP SDK for QCloud COS

v4.3.2(8y ago)0167MITPHPPHP &gt;=5.3.0

Since Jun 26Pushed 8y ago1 watchersCompare

[ Source](https://github.com/houxiaobei/cos-php-sdk-v4)[ Packagist](https://packagist.org/packages/houxiaobei/qcloud-cos-v4)[ RSS](/packages/houxiaobei-qcloud-cos-v4/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (2)Used By (0)

cos-php-sdk：php sdk for [腾讯云对象存储服务](https://www.qcloud.com/product/cos.html)
============================================================================

[](#cos-php-sdkphp-sdk-for-腾讯云对象存储服务)

### 安装（直接下载源码集成）

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

直接从[github](https://github.com/tencentyun/cos-php-sdk-v4)下载源码，然后在您的程序中加载cos-php-sdk-v4/include.php就可以了。

### 修改配置

[](#修改配置)

配置使用数组形式

COS所在的区域(region)，对应关系如下： 华南 -&gt; gz 华中 -&gt; sh 华北 -&gt; tj

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

### 示例程序

[](#示例程序)

请参考sample.php

```
// 包含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);
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 79.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3245d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/76655353411c64ce50ea549fe5b927c28375bf05fd261f9785349f42acfb5583?d=identicon)[houxiaobei](/maintainers/houxiaobei)

---

Top Contributors

[![yaozongyou](https://avatars.githubusercontent.com/u/590761?v=4)](https://github.com/yaozongyou "yaozongyou (31 commits)")[![ACTom](https://avatars.githubusercontent.com/u/6156919?v=4)](https://github.com/ACTom "ACTom (5 commits)")[![houxiaobei](https://avatars.githubusercontent.com/u/1086800?v=4)](https://github.com/houxiaobei "houxiaobei (1 commits)")[![luoxiaojun1992](https://avatars.githubusercontent.com/u/6905700?v=4)](https://github.com/luoxiaojun1992 "luoxiaojun1992 (1 commits)")[![shijiaxiong](https://avatars.githubusercontent.com/u/13504969?v=4)](https://github.com/shijiaxiong "shijiaxiong (1 commits)")

---

Tags

phpqcloudcos

### Embed Badge

![Health badge](/badges/houxiaobei-qcloud-cos-v4/health.svg)

```
[![Health](https://phpackages.com/badges/houxiaobei-qcloud-cos-v4/health.svg)](https://phpackages.com/packages/houxiaobei-qcloud-cos-v4)
```

###  Alternatives

[qcloud/cos-sdk-v5

PHP SDK for QCloud COS

2051.5M129](/packages/qcloud-cos-sdk-v5)[blueimp/jquery-file-upload

File Upload widget for jQuery.

141.5M18](/packages/blueimp-jquery-file-upload)[qcloud/cos-sdk-v4

PHP SDK for QCloud COS

4121.9k3](/packages/qcloud-cos-sdk-v4)[qcloud_sts/qcloud-sts-sdk

PHP SDK for QCloud STS

10173.3k9](/packages/qcloud-sts-qcloud-sts-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
