PHPackages                             colee/yii2-oss - 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. colee/yii2-oss

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

colee/yii2-oss
==============

Aliyun OSS library for Yii2 framework

1.1.0(9y ago)0421MITPHPPHP ~5.5|~7.0

Since Mar 19Pushed 9y ago1 watchersCompare

[ Source](https://github.com/colee1985/yii2-aliyun-oss)[ Packagist](https://packagist.org/packages/colee/yii2-oss)[ Docs](https://github.com/colee1985/yii2-oss)[ RSS](/packages/colee-yii2-oss/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

yii2-oss
========

[](#yii2-oss)

应用于YII2基于阿里云OSS-SDK封装的YII2-OSS-SDK

install
-------

[](#install)

composer require colee/yii2-oss

usage
-----

[](#usage)

在配置文件中配置components

```
'oss'=>[
    'class'=>'colee\oss\AliOss',
    'bucket'=>'99n9',
    'prefix'=>'chisheng/',
    'AccessKeyId' => '你的AccessKeyId',
    'AccessKeySecret' => '你的AccessKeySecret',
    'endpoint'=>'oss-cn-hangzhou.aliyuncs.com', // 资源访问地址
    'imageHost' => 'http://99n9.img-cn-hangzhou.aliyuncs.com/' //如果你的OSS backet开启的图片服务就可以配置这里
],
```

常用的方法：

>

```
\Yii::$app->oss->upload2oss($tempName, $path=null); // 将文件上传
\Yii::$app->oss->uploadStream2oss($stream,$path=null); // 将字节流上传
\Yii::$app->oss->getItem($path);  // 获取源文件访问URL，$path为资源在OSS中的路径
\Yii::$app->oss->getImageUrl($path, $style); // 获取缩略图URL，$style对应尺寸样式(在OSS图片服务中定义)
```

更多方法请参考 /aliyun-oss-php-sdk-2.2.1/src/OSS/OssClient.php

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

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

Total

2

Last Release

3471d ago

### Community

Maintainers

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

---

Tags

yii2aliyunwidgetosscoleealiyun-sdkyii2-oss

### Embed Badge

![Health badge](/badges/colee-yii2-oss/health.svg)

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

###  Alternatives

[johnlui/aliyun-oss

阿里云 OSS 官方 SDK 的 Composer 封装，支持任何 PHP 项目，包括 Laravel、Symfony、TinyLara 等等。

488179.3k6](/packages/johnlui-aliyun-oss)[alphasnow/aliyun-oss-flysystem

Flysystem adapter for the Aliyun storage

14270.2k8](/packages/alphasnow-aliyun-oss-flysystem)

PHPackages © 2026

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