PHPackages                             feehi/yii2-cdn - 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. feehi/yii2-cdn

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

feehi/yii2-cdn
==============

yii2 cdn

0.0.4(7y ago)86.1k↓100%42MITPHP

Since Jan 17Pushed 7y ago1 watchersCompare

[ Source](https://github.com/liufee/yii2-cdn)[ Packagist](https://packagist.org/packages/feehi/yii2-cdn)[ Docs](http://blog.feehi.com)[ RSS](/packages/feehi-yii2-cdn/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (5)Used By (2)

yii2 cdn
========

[](#yii2-cdn)

yii2 cdn，支持 七牛、网易云、腾讯云、阿里云的cdn。可以随时使用/取消yii2项目使用cdn。

安装
--

[](#安装)

1. 使用composer composer的安装以及国内镜像设置请点击[此处](http://www.phpcomposer.com/)

    ```
    $ cd /path/to/yii2-app
    $ composer require "feehi/yii2-cdn"
    $ composer install -vvv
    ```
2. 手动导入 下载yii2-cdn包后放置在任意目录 然后在yii2 index.php中

    ```
       require "/path/to/yii2-cdn/autoload.php";
    ```

配置
--

[](#配置)

yii2 cdn是作为一个组件提供服务的，所以得配置yii2 cdn组件。打开common/config/main.php在components块内增加

1.使用七牛的配置

```
    'components' => [
        'cdn' => [
            'class' => feehi\cdn\QiniuTarget::className(),
            'accessKey' => 'xxxxxxx',
            'secretKey' => 'xxxxxxxxx',
            'bucket' => 'xxx',
            'host' => 'http://xxxx.xxx.com'
        ]
    ]
```

2.使用阿里云的配置

```
    'components' => [
        'cdn' => [
            'class' => feehi\cdn\AliossTarget::className(),
            'bucket' => 'xxx',
            'accessKey' => 'xxxx',
            'accessSecret' => 'xxxxxxx',
            'endPoint' => 'oss-cn-beijing.aliyuncs.com',
            'host' => 'http://xxxx.xxx.com'
        ]
    ]
```

3.使用腾讯云的配置

```
    'components' => [
        'cdn' => [
            'class' => feehi\cdn\QcloudTarget::className(),
            'appId' => 'xxxxx',
            'secretId' => 'xxxxxx',
            'secretKey' => 'xxxxxxx',
            'region' => 'tj',
            'bucket' => 'xxx',
            'host' => 'http://image-1251086492.costj.myqcloud.com',
        ]
    ]
```

4.使用网易云的配置

```
    'components' => [
        'cdn' => [
            class' => feehi\cdn\NeteaseTarget::className(),
            'accessKey' => 'xxxxx',
            'accessSecret' => 'xxxxxxx',
            'endPoint' => 'nos-eastchina1.126.net',
            'bucket' => 'xxx',
            'host' => 'http://xxxx.xxx.com'
        ]
    ]
```

5.不使用cdn时的配置(不需要修改代码文件)

```
    'components' => [
        'cdn' => [
            class' => feehi\cdn\DummyTarget::className(),
        ]
    ]
```

示例
--

[](#示例)

见[examples/demo.php](examples/demo.php)

说明
--

[](#说明)

yii2 cdn集成了国内常用四个cdn厂商的sdk，以yii2组件的方式提供服务，屏蔽了厂商不同的api名称、调用方式。但是yii2 cdn只实现了几个常用的api：上传文件 分片上传 检测文件是否存在 删除文件。其他相应的操作需要自行实现。

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity56

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

Total

4

Last Release

2792d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0452fe858dc13954ce183f1dc537fdbb934a8d1255cb0a57d95256db00991609?d=identicon)[liufee](/maintainers/liufee)

---

Top Contributors

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

---

Tags

yii2qiniuossyii2-ossyii2-qiniu

### Embed Badge

![Health badge](/badges/feehi-yii2-cdn/health.svg)

```
[![Health](https://phpackages.com/badges/feehi-yii2-cdn/health.svg)](https://phpackages.com/packages/feehi-yii2-cdn)
```

###  Alternatives

[yangyifan/upload

上传 SDK for Laravel

12422.6k3](/packages/yangyifan-upload)[aliyuncs/aliyun-oss-php-sdk-laravel

A simple Laravel 5 and lumen service provider for including the Oss PHP SDK for PHP.

7935.4k2](/packages/aliyuncs-aliyun-oss-php-sdk-laravel)[qinchen/web-utils

A web application common utils

111.4k](/packages/qinchen-web-utils)

PHPackages © 2026

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