PHPackages                             xiaochengfu/yii2-mns - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. xiaochengfu/yii2-mns

ActiveYii2-extension[Mail &amp; Notifications](/categories/mail)

xiaochengfu/yii2-mns
====================

阿里云、云片短信推送，yii2-mns

v1.0.1(8y ago)134BSD-3-ClausePHP

Since Aug 7Pushed 8y ago1 watchersCompare

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

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

阿里云、云片短信推送，yii2-mns
===================

[](#阿里云云片短信推送yii2-mns)

阿里云、云片短信推送

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
composer require xiaochengfu/yii2-mns "v1.0.1"

```

or add

```
"xiaochengfu/yii2-mns": "*"

```

to the require section of your `composer.json` file.

Usage
-----

[](#usage)

1.在主配置文件中增加components

```
'components' => [
      'mns'=>[
                 'class'=> 'xiaochengfu\mns\Module',
                 'config'=>[
                     'aliyun'=>[
                         'active'=>true, //true位开启，false为关闭
                         'accessId' => 'xxxx',
                         'accessKey' => 'xxxxxxxxx',
                         'endpoint' => 'http://xxxx.mns.cn-hangzhou.aliyuncs.com/',
                         'topicName' => 'xxx',
                         'smsSignName' => 'xxxx',
                     ],
                     'yunpian' => [
                         'active'=>false,
                         'apikey' => 'xxxxxx', // 请替换成您的apikey
                     ]
                 ]

             ],
]
```

2.在程序中使用：

当使用云片时：

```
$smsParams = '具体的消息内容';

```

当使用阿里云时：

```
$smsParams = [
    'code'=>'xxx',
    'product'=>'xxx'
];

```

单条发送：

```
Yii::$app->mns->send('186********',$smsParams,MnsComponent::YZM);

```

//批量发送

```
$mobile = ['phone1','phone2','phone3'];
$result = Yii::$app->mns->batchSend($mobile,$smsParams,MnsComponent::YZM);

```

$smsParams与MnsComponent::YZM的类型要一致，这里可以根据自己的模板id自行定义规则！

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

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

Unknown

Total

1

Last Release

3201d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1a10742992d52a3b211ea0790e1db0e1eb0c4230296b34b290457fa520a8d4ef?d=identicon)[xiaochengfu](/maintainers/xiaochengfu)

---

Top Contributors

[![xiaochengfu](https://avatars.githubusercontent.com/u/15496255?v=4)](https://github.com/xiaochengfu "xiaochengfu (13 commits)")

---

Tags

yii2extensionaliyun-mnsyii2-aliyun-mns

### Embed Badge

![Health badge](/badges/xiaochengfu-yii2-mns/health.svg)

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

###  Alternatives

[nterms/yii2-mailqueue

Email queue component for yii2 that works with yii2-swiftmailer.

87129.2k2](/packages/nterms-yii2-mailqueue)[nickcv/yii2-mandrill

Mandrill Api Integration for Yii2

29554.2k2](/packages/nickcv-yii2-mandrill)[odaialali/yii2-toastr

This is the Toastr extension for Yii 2. It encapsulates Toastr plugin in terms of Yii widgets, and makes ajax notification easy to implement.

1486.3k](/packages/odaialali-yii2-toastr)

PHPackages © 2026

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