PHPackages                             hongyukeji/yii2-sms - 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. hongyukeji/yii2-sms

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

hongyukeji/yii2-sms
===================

This is a SMS sending component.

v1.0(8y ago)261MITPHPPHP &gt;=5.4.0

Since Feb 24Pushed 8y agoCompare

[ Source](https://github.com/hongyukeji/yii2-sms)[ Packagist](https://packagist.org/packages/hongyukeji/yii2-sms)[ RSS](/packages/hongyukeji-yii2-sms/feed)WikiDiscussions master Synced yesterday

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

Yii2 短信扩展组件 - [鸿宇科技](http://www.hongyuvip.com/)
===============================================

[](#yii2-短信扩展组件---鸿宇科技)

> Yii2 短信扩展组件，目前支持阿里短信、云片短信，并且支持批量发送短信。设置默认短信后，会自动切换短信服务商。

> 碎碎念：没啥好说的，别人写的扩展组件，总是没有自己写的用起来顺手。方便自己，造福他人。

[![Latest Stable Version](https://camo.githubusercontent.com/aa23a212a9da9e5c0793879c2cf52395438d4793d6ad8fc0ee35e117f862eb4d/68747470733a2f2f706f7365722e707567782e6f72672f686f6e6779756b656a692f796969322d736d732f762f737461626c652e706e67)](https://packagist.org/packages/hongyukeji/yii2-sms)[![Total Downloads](https://camo.githubusercontent.com/d0796e2f3a661479f96f3e2e9ebf865b86c680482f60f7a53dc90348ce043099/68747470733a2f2f706f7365722e707567782e6f72672f686f6e6779756b656a692f796969322d736d732f646f776e6c6f6164732e706e67)](https://packagist.org/packages/hongyukeji/yii2-sms)

安装
--

[](#安装)

```
# 生产环境
$ composer require hongyukeji/yii2-sms

# 开发环境
$ composer require hongyukeji/yii2-sms dev-master

```

配置
--

[](#配置)

- main.php / web.php

> 阿里短信教程 [https://help.aliyun.com/document\_detail/59210.html](https://help.aliyun.com/document_detail/59210.html)

> 云片短信教程 [https://www.yunpian.com/doc/zh\_CN/introduction/demos/php.html](https://www.yunpian.com/doc/zh_CN/introduction/demos/php.html)

```
return [
    'components' => [

        // ```
        'sms' => [
            'class' => 'HongYuKeJi\Components\Sms\SendSms',
            'config' => [
                'default' => 'aliSms',    // 默认短信
                'aliSms' => [
                    'accessKeyId' => '',
                    'accessKeySecret' => '',
                    'signName' => '',
                    'templateCode' => [
                        'verificationCode' => '',
                    ],
                ],
                'yunpianSms' => [
                    'apikey' => '',
                    'signName' => '',
                    'templateCode' => [
                        'verificationCode' => '',
                    ],
                ],
            ],
        ],

        // ```
    ],
];
```

使用
--

[](#使用)

> 具体使用，请阅读 src/SendSms.php 文件

```
$result = Yii::$app->sms->send(
    'verificationCode',
    '13800138000',
    ['code' => '123456', 'product' => 'name']
);

if ($result['code'] == '0') {
    echo '发送成功';
} else {
    echo '发送失败: ' . $result['message'];
}

// 手机号为数组格式，可以批量发送短信，如：['13800138000','13900139000']
// 返回格式: ['code'=>'...','message'=>'...']
// code返回码说明: 0-发送成功, 1-发送失败
```

关于
--

[](#关于)

- Site：[www.hongyuvip.com](http://www.hongyuvip.com)
- Author：Shadow
- QQ：1527200768
- Phone：13952101395
- Email：

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

2999d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/484917e0c99c9779961352578c18bae13504567d6ec43cc3c594b3e447aad436?d=identicon)[hongyukeji](/maintainers/hongyukeji)

### Embed Badge

![Health badge](/badges/hongyukeji-yii2-sms/health.svg)

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

PHPackages © 2026

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