PHPackages                             gk-qcloudapi-sdk-php/cospackage - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. gk-qcloudapi-sdk-php/cospackage

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

gk-qcloudapi-sdk-php/cospackage
===============================

2.2(7y ago)115MITPHPPHP &gt;=5.6

Since Sep 22Pushed 7y agoCompare

[ Source](https://github.com/techjkweixin/gk-qcloudapi-sdk-php)[ Packagist](https://packagist.org/packages/gk-qcloudapi-sdk-php/cospackage)[ RSS](/packages/gk-qcloudapi-sdk-php-cospackage/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (1)DependenciesVersions (7)Used By (0)

\#集客腾讯云cos扩张包使用说明SDK
--------------------

[](#集客腾讯云cos扩张包使用说明sdk)

腾讯云[对象存储服务 COS](http://www.qcloud.com/wiki/COS%E4%BA%A7%E5%93%81%E4%BB%8B%E7%BB%8D) PHP SDK

俊峰啊，如何安装？
---------

[](#俊峰啊如何安装)

项目根目录composer.json配置require

```
   "require": {
         "gk-qcloudapi-sdk-php/cospackage": "~2.1",
       "qcloud/cos-sdk-v5": ">=1.0",
       "qcloud/vod-sdk-v5": "v1.2.1"
       }

     "repositories": {
       "cospackage": {
           "type": "vcs",
           "url": "https://github.com/techjkweixin/gk-qcloudapi-sdk-php.git"
       }
   }

```

通过COMPOSER 命令获取项目
-----------------

[](#通过composer-命令获取项目)

```
 composer update

```

配置项目
----

[](#配置项目)

\#####使用的是lumen框架在 bootstrap下的app.php

```
 $app->register(Gkcosapi\Cospackage\CospackageServiceProvider::class);
 $app->configure('cospackage');

> 如果需要新增路由模块需要如下操作
> 注意：
> 1、需要在Http/controllers/创建Objectstore目录且复制扩展包DEMO目录中的VodapiController文件到该目录
> 2、扩展包DEMO目录中的cos.php复制到routes目录中
> 3、将下列代码一并写入bootstrap/app.php

$app->router->group([
    'prefix' => env('APP_VERSION') . '/api/cos',
    'namespace' => 'App\Http\Controllers\Objectstore',
], function ($router) {
    require __DIR__ . '/../routes/cos.php';
});

```

---

\#####使用的是laravel框架在 config/app.php

```
'providers' => [
    ...
    Gkcosapi\Cospackage\CospackageServiceProvider::class,
    ... ]
'aliases' => [
    ...
    'TencentIm' => Gkcosapi\Cospackage\Facade\Cospackage::class,
    ... ]

```

---

\#####用发布命令将包配置复制到本地配置 $ php artisan vendor:publish --provider="Eddie\\Tencent\\Provider\\ImServiceProvider" #####初始化扩展包 composer dump-autoload

安装
--

[](#安装)

```
composer require jerray/qcloud-cos-php-sdk

```

COS文件图片上传使用方法
-------------

[](#cos文件图片上传使用方法)

\#####1、在业务层引用扩展包

```
use Gkcosapi\Cospackage\Facades\Cospackage;

```

\#####2调取扩展函数 进行cos文件上传工作

```
Cospackage::uploadFile($file->getPathname(), 'jpg');

```

\#####3、操作函数介绍：

```
Cospackage::uploadFile($file->getPathname(), 'jpg');//cos文件上传工作

Cospackage::getResource($url)//获取文件资源

Cospackage::getUploadSign($fileType = "image", $method = "post")//获取cos签名

Cospackage::getUploadParam($key)//获取文件上传参数 key:定义的文件目录名称或mercharID(生成目录)

```

VOd上传使用方法
---------

[](#vod上传使用方法)

\#####1、同COS一样引入扩展包; #####2、使用方法同理：

```
Cospackage::getSignKey();

```

\#####3、操作函数介绍请参考扩展包demo目录中VodapiController.php

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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

Every ~3 days

Total

6

Last Release

2814d ago

Major Versions

1.2.4 → 2.02018-09-22

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/42922980?v=4)[techjkweixin](/maintainers/techjkweixin)[@techjkweixin](https://github.com/techjkweixin)

---

Top Contributors

[![techjkweixin](https://avatars.githubusercontent.com/u/42922980?v=4)](https://github.com/techjkweixin "techjkweixin (6 commits)")

### Embed Badge

![Health badge](/badges/gk-qcloudapi-sdk-php-cospackage/health.svg)

```
[![Health](https://phpackages.com/badges/gk-qcloudapi-sdk-php-cospackage/health.svg)](https://phpackages.com/packages/gk-qcloudapi-sdk-php-cospackage)
```

###  Alternatives

[netgen/layouts-ui

Netgen Layouts user interface

17112.7k4](/packages/netgen-layouts-ui)[mestrona/magento-module-categoryredirect

Magento 2 Module to simply customize the menu with additional URLs: Create a category, enter the redirect, done.

2144.1k](/packages/mestrona-magento-module-categoryredirect)[dragon-code/laravel-route-names

Automatic generation of route names

259.2k1](/packages/dragon-code-laravel-route-names)[xefi/faker-php-locales-en-us

Faker extension to include en\_US locale

162.6k](/packages/xefi-faker-php-locales-en-us)

PHPackages © 2026

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