PHPackages                             wsmallnews/laravel-cos - 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. [API Development](/categories/api)
4. /
5. wsmallnews/laravel-cos

ActiveLibrary[API Development](/categories/api)

wsmallnews/laravel-cos
======================

qclouds api

1.0.2(9y ago)33.3k[1 issues](https://github.com/Wsmallnews/laravel-cos/issues)1MITPHP

Since Jun 3Pushed 9y ago1 watchersCompare

[ Source](https://github.com/Wsmallnews/laravel-cos)[ Packagist](https://packagist.org/packages/wsmallnews/laravel-cos)[ RSS](/packages/wsmallnews-laravel-cos/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (3)DependenciesVersions (4)Used By (1)

腾讯云对象存储的 composer 包
-------------------

[](#腾讯云对象存储的-composer-包)

> 本包主要代码是腾讯云官方代码，但因官方一直没有composer 包，特此造了此轮子，本文档会不定时更新

### 版本更新时间

[](#版本更新时间)

```
2017-06-15

```

### 腾讯云对象存储官方文档

[](#腾讯云对象存储官方文档)

```
https://www.qcloud.com/document/product/436/6274

```

### 安装

[](#安装)

```
composer require wsmallnews/laravel-cos

```

### 建立配置文件如下

[](#建立配置文件如下)

config/qcloud.php

```
return [

    'cos' => [     // 腾讯云 对象存储
        'driver'    => 'cos',
        'root' => env('QCLOUD_ROOT', ''),
        'host' => env('QCLOUD_HOST', ''),
        'bucket' => env('QCLOUD_BUCKET'),
        'api_cos_api_end_point' => env('QCLOUD_API_COS_API_END_POINT', "http://sh.file.myqcloud.com/files/v2/"),
        'app_id' => env('QCLOUD_APPID'),
        'secret_id' => env('QCLOUD_SECRET_ID'),
        'secret_key' => env('QCLOUD_SECRET_KEY'),
        'time_out' => env('QCLOUD_TIME_OUT', 180),
        'location' => env('QCLOUD_LOCATION', 'sh'),
    ],
];

```

### 添加服务提供者

[](#添加服务提供者)

```
Smallnews\Cos\QCloudCosServiceProvider::class,

```

### 使用

[](#使用)

##### 第一种方法

[](#第一种方法)

```
use Smallnews\Cos\QCloudCosOper;

public function getAppId(){
    echo QCloudCosOper::getAppId();
}

```

##### 第二种方法

[](#第二种方法)

```
app('qcloudcos')::getAppId();

```

### 方法总揽

[](#方法总揽)

> 下面列出了所有接口，接口参数只给了必填参数，其他参数可参考腾讯云官方对象存储文档查看，已将所有方法中的 $bucketName参数默认使用配置文件中的 bucket 配置

```
QCloudCosOper::setBucket($bucket);                  // 设置bucket
QCloudCosOper::getBucket();                         // 获取bucket
QCloudCosOper::getAppId();                          // 获取 appId
QCloudCosOper::createFolder($folder);               // 创建目录
QCloudCosOper::upload($srcPath, $dstPath);          // 上传文件
QCloudCosOper::listFolder($folder);                 // 目录列表
QCloudCosOper::prefixSearch($prefix);               // 目录列表(前缀搜索)
QCloudCosOper::updateFolder($folder);               // 更新目录

QCloudCosOper::statFolder($folder);                 // 查询目录信息
QCloudCosOper::stat($path);                         // 查询文件信息
QCloudCosOper::copyFile($srcFpath, $dstFpath);      // 复制一个文件
QCloudCosOper::moveFile($srcFpath, $dstFpath);      // 移动一个文件
QCloudCosOper::delFile($path);                      // 删除文件
QCloudCosOper::delFolder($folder);                  // 删除目录

```

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity65

Established project with proven stability

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

Every ~6 days

Total

3

Last Release

3298d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16216215?v=4)[小新](/maintainers/Wsmallnews)[@Wsmallnews](https://github.com/Wsmallnews)

---

Tags

laravelqcloudcoslaravel-costengxun

### Embed Badge

![Health badge](/badges/wsmallnews-laravel-cos/health.svg)

```
[![Health](https://phpackages.com/badges/wsmallnews-laravel-cos/health.svg)](https://phpackages.com/packages/wsmallnews-laravel-cos)
```

###  Alternatives

[jingling0101/laravel-qcloud-cos

腾讯云COS对象存储 laravel qclouds cos

183.9k](/packages/jingling0101-laravel-qcloud-cos)[rakibdevs/openweather-laravel-api

Laravel package to connect https://openweathermap.org/ to get customized weather data for any location on the globe immediately

7651.3k](/packages/rakibdevs-openweather-laravel-api)

PHPackages © 2026

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