PHPackages                             itinysun/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. [File &amp; Storage](/categories/file-storage)
4. /
5. itinysun/laravel-cos

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

itinysun/laravel-cos
====================

Flysystem sdk for Tencent Cos

0.0.10(1w ago)0250MITPHPPHP ^8.1CI failing

Since Apr 19Pushed 3w ago1 watchersCompare

[ Source](https://github.com/Itinysun/laravel-cos)[ Packagist](https://packagist.org/packages/itinysun/laravel-cos)[ Docs](https://github.com/itinysun/laravel-cos)[ RSS](/packages/itinysun-laravel-cos/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (25)Versions (11)Used By (0)

Flysystem sdk for Tencent Cos
=============================

[](#flysystem-sdk-for-tencent-cos)

[![Latest Version on Packagist](https://camo.githubusercontent.com/9bca4164f45048dc576ce4242c0b291bb45c713fb614ae2e728fd4c56d3aeb68/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6974696e7973756e2f6c61726176656c2d636f732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/itinysun/laravel-cos)[![GitHub Tests Action Status](https://camo.githubusercontent.com/5a542c42bc972943daa60e8046be765ab6006a11a787c271bb69695b1953494d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6974696e7973756e2f6c61726176656c2d636f732f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/itinysun/laravel-cos/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/d994d0c3ff84e9f7f091cf3e2e1c88bb43785eeb1dddd77899eeaf9931446297/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6974696e7973756e2f6c61726176656c2d636f732f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/itinysun/laravel-cos/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/38f2a9f2507b081aacc3f1d398109bfa4cd5871aafd3493c80130f92c84783f1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6974696e7973756e2f6c61726176656c2d636f732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/itinysun/laravel-cos)

一个使用腾讯云原生SDK实现的laravel文件存储扩展包,支持切片上传和下载
---------------------------------------

[](#一个使用腾讯云原生sdk实现的laravel文件存储扩展包支持切片上传和下载)

Installation 安装
---------------

[](#installation-安装)

#### 使用composer 安装 You can install the package via composer:

[](#使用composer-安装-you-can-install-the-package-via-composer)

```
composer require itinysun/laravel-cos
```

#### 发布配置文件 You can publish the config file with:

[](#发布配置文件-you-can-publish-the-config-file-with)

```
php artisan vendor:publish --tag="cos-config"
```

This is the contents of the published config file:

```
return [
    'default' => [
        'app_id' => env('COS_APP_ID'),
        'secret_id' => env('COS_SECRET_ID'),
        'secret_key' => env('COS_SECRET_KEY'),
        'bucket' => env('COS_BUCKET'),  // 不带数字 app_id 后缀

        'region' => 'ap-beijing',

        // 可选，如果 bucket 为私有访问请打开此项
        'signed_url' => true,

        // 可选，是否使用 https，默认 false
        'use_https' => true,

        // 可选，自定义域名
        'domain' => '',

        // 可选，使用 CDN 域名时指定生成的 URL host
        'cdn' => '',

        'prefix' => '', // 全局路径前缀
    ],
];
```

Usage
-----

[](#usage)

```
//直接使用cos客户端
$laravelCos = new Itinysun\LaravelCos\Lib\LaravelCos('default');

// 上传文件
$laravelCos->uploadFile('test.txt', 'local/test.txt');

//使用facade
use Itinysun\LaravelCos\Facades\LaravelCos;
LaravelCos::uploadFile('test.txt', 'local/test.txt');

//使用laravel的storage
//首先在config/filesystems.php 中添加一个 disk,config_name 是上面配置文件中的key
        'cos_disk' => [
            'driver' => 'cos',
            'config_name' => 'cos_source',
        ],

//然后就可以使用laravel的storage了
```

Testing
-------

[](#testing)

扩展包使用[TestBench](https://packages.tools/getting-started.html)进行测试,不需要安装laravel

```
### 发布测试文件
composer build
```

### 填写一个cos配置到 test\_config.php , 切记这个文件不要提交到版本控制,已经在.gitignore中忽略了

[](#填写一个cos配置到-test_configphp--切记这个文件不要提交到版本控制已经在gitignore中忽略了)

```
```bash
### 运行测试
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Credits
-------

[](#credits)

- [Itinysun](https://github.com/Itinysun)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance96

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 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 ~53 days

Recently: every ~32 days

Total

9

Last Release

11d ago

PHP version history (2 changes)v0.0.2PHP ^8.4

v0.0.6PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/dc83a23d3cdc2fb33144705d4185c7431220d16ecf62903e40f1c4cfd24a2c79?d=identicon)[tinysun](/maintainers/tinysun)

---

Top Contributors

[![Itinysun](https://avatars.githubusercontent.com/u/5356264?v=4)](https://github.com/Itinysun "Itinysun (8 commits)")

---

Tags

coslaravelphptencent-coslaravellaravel-cosItinysun

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[spatie/laravel-passkeys

Use passkeys in your Laravel app

471890.7k39](/packages/spatie-laravel-passkeys)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[harris21/laravel-fuse

Circuit breaker for Laravel queue jobs. Protect your workers from cascading failures.

44855.7k](/packages/harris21-laravel-fuse)[danestves/laravel-polar

A package to easily integrate your Laravel application with Polar.sh

8120.4k](/packages/danestves-laravel-polar)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24857.5k](/packages/vormkracht10-laravel-mails)

PHPackages © 2026

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