PHPackages                             brayun/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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. brayun/yii2-sms

ActiveYii2-extension[Validation &amp; Sanitization](/categories/validation)

brayun/yii2-sms
===============

短信使用阿里云短信

1.6(8y ago)043MITPHP

Since Sep 9Pushed 8y agoCompare

[ Source](https://github.com/brayun/yii2-sms)[ Packagist](https://packagist.org/packages/brayun/yii2-sms)[ Docs](https://www.brayun.com)[ RSS](/packages/brayun-yii2-sms/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (6)Dependencies (1)Versions (8)Used By (0)

 [ ![上海柏锐网络科技有限公司](https://camo.githubusercontent.com/380a1444bbb495906d97d789817b0dd68629cb66d4be3988c888e1f427c3be0d/68747470733a2f2f7777772e62726179756e2e636f6d2f696d672f746f7563682f6368726f6d652d746f7563682d69636f6e2d313932783139322e706e67) ](https://www.brayun.com/)

 [上海柏锐网络科技有限公司](https://www.brayun.com)是一家技术型服务企业.可提供专业的技术外包服务,定制OA,ERP,电商系统,H5网站,天猫淘宝H5,欢迎前来咨询

安装
--

[](#安装)

```
composer require brayun/yii2-sms
```

示例 Controller 添加actions
-----------------------

[](#示例-controller-添加actions)

```
public function actions()
{
    return [
        'smscode' => [
            'class' => SendAction::className(),
            'tplCode' => 'SMS_94663333',
            'signName' => '我是签名',
            'params' => [
                'code' => rand(1000, 9999)
            ],
            'beforeFunction' => function () {
                if (User::findOne(['mobile' => \Yii::$app->request->post('mobile')])) {
                    return [
                        'code' => 1,
                        'msg' => '手机号码已存在!'
                    ];
                }
            }
        ]
    ];
}
```

示例Model
-------

[](#示例model)

```
public function rules()
{
    return [
        ...
        ['code', PhoneCodeValidator::className()],
    ];
}
```

组件使用示例 main.php components下添加
-----------------------------

[](#组件使用示例-mainphp-components下添加)

```
'components' => [
    'sms' => [
        'class' => 'brayun\sms\Application',
        'signName' => '统一签名'
    ],
    ...
]
```

### 组件使用

[](#组件使用)

```
Yii::$app->sms->send('13000000000','SMS_123456',['code'=>1234], '这里签名可另写');
```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity68

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

Every ~12 days

Recently: every ~18 days

Total

7

Last Release

3141d ago

### Community

Maintainers

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

---

Top Contributors

[![brayun](https://avatars.githubusercontent.com/u/31040271?v=4)](https://github.com/brayun "brayun (7 commits)")

---

Tags

validationsmsyii2

### Embed Badge

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

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

###  Alternatives

[codeonyii/yii2-at-least-validator

Validates at least one (or more) attributes.

28260.2k1](/packages/codeonyii-yii2-at-least-validator)[cebe/yii2-lifecycle-behavior

Define the lifecycle of a model by defining allowed satus changes in terms of a state machine.

5120.3k1](/packages/cebe-yii2-lifecycle-behavior)[z4kn4fein/php-semver

Semantic Versioning library for PHP. It implements the full semantic version 2.0.0 specification and provides ability to parse, compare, and increment semantic versions along with validation against constraints.

251.6M18](/packages/z4kn4fein-php-semver)[phpexperts/datatype-validator

An easy to use data type validator (both strict and fuzzy).

131.2M2](/packages/phpexperts-datatype-validator)

PHPackages © 2026

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