PHPackages                             mrh/aliyunsdk - 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. [API Development](/categories/api)
4. /
5. mrh/aliyunsdk

ActiveLibrary[API Development](/categories/api)

mrh/aliyunsdk
=============

aliyun php sdk

133PHP

Since Jan 22Pushed 7y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

简介
--

[](#简介)

aliyun官方sdk开发包，支持yii2

下载安装
----

[](#下载安装)

- 下载

```
git clone https://github.com/mrh111/aliyunsdk.git
```

- 安装

进入 aliyunsdk 目录，执行

```
composer require "mrh/aliyunsdk:dev-master"
```

- 项目中的使用

在config/main.php配置文件中定义component配置信息, 以视频播放vod为例

```
'components' => [
  .....
  'aliyunVod' => [
      'class' => 'common\components\AliyunVideo',
      'accessKeyId' => '666666',
      'accessKeySecret' => '999999999999999999999'
    ],
  ....
]
```

在项目common\\components目录下创建 AliyunVideo类

```
namespace common\components;
use yii;
use yii\base\Component;
use DefaultAcsClient;
use DefaultProfile;

use vod\Request\V20170321 as Vod;

class AliyunVideo extends Component {

    public $accessKeyId = '';

    public $accessKeySecret = '';

    private $regionId = 'cn-shanghai';

    /**
     * 初始化
     * @return DefaultAcsClient
     */
    public function client(){
        $profile = DefaultProfile::getProfile($this->regionId, $this->accessKeyId, $this->accessKeySecret);
        return new DefaultAcsClient($profile);
    }

    /**
     * 获取播放凭证
     * @param $client
     * @param $videoid 视频ID
     * @return mixed
     */
    public function get_video_play_auth($client, $videoid){
        $request = new Vod\GetVideoPlayAuthRequest();
        $request->setAcceptFormat('JSON');
        $request->setRegionId($this->regionId);
        $request->setVideoId($videoid);
        $response = $client->getAcsResponse($request);
        return $response;
    }

    /**
     * 获取播放url地址信息
     * @param $client
     * @param $videoId
     * @return mixed
     */
    public function get_play_info($client, $videoId) {
        $request = new Vod\GetPlayInfoRequest();
        $request->setVideoId($videoId);
        $request->setAuthTimeout(3600*24);    // 播放地址过期时间（只有开启了URL鉴权才生效），默认为3600秒，支持设置最小值为3600秒
        $request->setAcceptFormat('JSON');
        return $client->getAcsResponse($request);
    }

}
```

在方法中调用

```
$video = yii::$app->aliyunVod;
$client = $video->client();
$info = $video->get_play_info($client, $videoId);
```

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/0abfac64f5352ed58e045f06925b044e882de5e5541509caace0f9e2b721262f?d=identicon)[mrh111](/maintainers/mrh111)

---

Top Contributors

[![mrh111](https://avatars.githubusercontent.com/u/18693712?v=4)](https://github.com/mrh111 "mrh111 (19 commits)")

### Embed Badge

![Health badge](/badges/mrh-aliyunsdk/health.svg)

```
[![Health](https://phpackages.com/badges/mrh-aliyunsdk/health.svg)](https://phpackages.com/packages/mrh-aliyunsdk)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35816.3M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24015.5M18](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172437.8k11](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

94452.6k6](/packages/botman-driver-telegram)

PHPackages © 2026

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