PHPackages                             gmars/tp5-qiniu - 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. gmars/tp5-qiniu

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

gmars/tp5-qiniu
===============

这是一个基于ThinkPHP5框架的扩展库，主要解决了文件上传七牛云的需求。当然在后边的更新中会提供七牛云中文件的管理功能以及bucket的管理，让tp5上传七牛云非常便捷。

1.0(9y ago)111.4k1[1 issues](https://github.com/gmars/qiniu-tp5/issues)MITPHP

Since Apr 25Pushed 9y ago1 watchersCompare

[ Source](https://github.com/gmars/qiniu-tp5)[ Packagist](https://packagist.org/packages/gmars/tp5-qiniu)[ RSS](/packages/gmars-tp5-qiniu/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (2)Used By (0)

qiniu-tp5

基于tp5框架的七牛云存储实现，可以方便的实现文件上传，文件管理功能。只需两行代码就能完成一次文件上传 安装方式。使用composer安装，在项目根目录下运行

composer require gmars/tp5-qiniu

如果该方法安装不成功，请在项目根目录下的composer.json的require中添加

"gmars/tp5-qiniu": "dev-master"

然后使用cmd进入项目根目录下运行composer update

使用方式：

一、配置使用

1.1配置：

在tp5的配置文件config.php中配置七牛云的配置参数，当然此插件支持实例化时再传入配置参数

'qiniu' =&gt; \[

```
    'accesskey' => '你自己的七牛云accesskey',
    'secretkey' => '你自己的七牛云secretkey',
    'bucket' => '你自己创建的bucket',

```

\]

1.2使用

try{

```
  $qiniu = new Qiniu();
  $result = $qiniu->upload();

```

}catch (Exception $e){

```
  dump($e);

```

}

如果上传成功则返回的是key值也就是文件对应的key使用你自己的域名拼接key就可以直接访问了

二、直接使用

try{

```
  $qiniu = new Qiniu('你自己的七牛云accesskey','你自己的七牛云secretkey','你自己创建的bucket');
  $result = $qiniu->upload();

```

}catch (Exception $e){

```
  dump($e);

```

}

如果修改了配置参数请先清除一下缓存文件，在runtime/cache目录下，因为本插件考虑到了文件上传的性能，对上传token进行了缓存，缓存时间为3600秒，如果配置参数改变后不清除缓存则可能会出现错误。 同时，upload()方法支持参数传入。可传入第一个参数为要上传文件保存的名称，第二个参数为bucket名称。

如果第一个参数不填写则上传后的文件名默认取文件的hash串拼接时间戳time()的方式。

如果第二个参数是支持不同的文件上传到不同的bucket的参数，也就是可以再文件上传时重新传bucket让文件上传到不同的bucket中

如果使用中有任何错误或者疑问可以给我发邮件：

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity63

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

Unknown

Total

1

Last Release

3352d ago

### Community

Maintainers

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

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/gmars-tp5-qiniu/health.svg)

```
[![Health](https://phpackages.com/badges/gmars-tp5-qiniu/health.svg)](https://phpackages.com/packages/gmars-tp5-qiniu)
```

###  Alternatives

[venveo/craft-compress

Create smart zip files from Craft assets on the fly

124.7k](/packages/venveo-craft-compress)

PHPackages © 2026

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