PHPackages                             zc/yii2-alisms - 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. zc/yii2-alisms

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

zc/yii2-alisms
==============

阿里大于发送短信 yii2扩展

117PHP

Since May 21Pushed 7y ago1 watchersCompare

[ Source](https://github.com/davidfang/yii2-alisms)[ Packagist](https://packagist.org/packages/zc/yii2-alisms)[ RSS](/packages/zc-yii2-alisms/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

阿里大于发送短信 yii2扩展
===============

[](#阿里大于发送短信-yii2扩展)

阿里大于发送短信 yii2扩展

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

[](#installation)

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

Either run

```
php composer.phar require --prefer-dist zc/yii2-alisms "*"

```

or add

```
"zc/yii2-alisms": "*"

```

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

Usage
-----

[](#usage)

Once the extension is installed, simply use it in your code by :

```

```

管理后台
----

[](#管理后台)

- 配置文件

```
'modules'=>[
            "sms" => [
                        "class" => "zc\yii2Alisms\Module",
                    ]
       ]
```

- 后台管理访问地址 模板 日志

前台访问
----

[](#前台访问)

- 配置文件

```
'controllerMap' => [
            'sms-api' => [
                            'class' => 'zc\yii2Alisms\controllers\ApiController',
                            'exitTime' => 300
                        ],
            ]
```

- 发验证码api访问地址 [http://example.dev/sms-api/get-code?mobile=15699999999&amp;id=1&amp;captcha=sdfwf](http://example.dev/sms-api/get-code?mobile=15699999999&id=1&captcha=sdfwf)参数：

    - mobile: 手机
    - id:短信模板ID
    - captcha：可选 ，在需要图形验证码的时候使用,是否需要图形验证码在后台设置

    返回：

    - status: true,
    - code: "7025",
    - hash1: "7025",原hash
    - hash2: "7025",小写hash
    - msg: "短信发送成功"

    说明： `hash1、hash2可以用于客户端的验证，验证方法参考下面`

    ```
      /** 生成方法
       * Generates a hash code that can be used for client-side validation.
       * @param string $code the CAPTCHA code
       * @return string a hash code generated from the CAPTCHA code
       * /
      public function generateValidationHash($code)
      {
          for ($h = 0, $i = strlen($code) - 1; $i >= 0; --$i) {
              $h += ord($code[$i]);
          }

          return $h;
      }
    ```
- 校验验证码api访问地址 （可以不用了） [http://example.dev/sms-api/check-code?mobile=15699999999&amp;code=1&amp;id=1](http://example.dev/sms-api/check-code?mobile=15699999999&code=1&id=1)

    - mobile: 手机
    - id:短信模板ID
    - code:验证码 校验验证码

---

在需要的model里面添加rule规则

```
['code', 'required'],
            //['code', 'checkCode'],
            ['code',  function ($attribute, $params) {
                $smsType = 1;//跟前台访问验证码的id一致
                if(!\zc\yii2Alisms\Sms::checkCode($this->mobile,$this->code,$smsType)){
                    $this->addError('code','手机验证码不正确');
                    return false;
                }
            }],
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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/b29cb353d503891d92c92f627effda01079dc22fc8520b833e63823483289fbe?d=identicon)[davidfang](/maintainers/davidfang)

---

Top Contributors

[![davidfang](https://avatars.githubusercontent.com/u/6745559?v=4)](https://github.com/davidfang "davidfang (1 commits)")

### Embed Badge

![Health badge](/badges/zc-yii2-alisms/health.svg)

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

###  Alternatives

[tijsverkoyen/css-to-inline-styles

CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.

5.8k505.3M227](/packages/tijsverkoyen-css-to-inline-styles)[minishlink/web-push

Web Push library for PHP

1.9k12.0M53](/packages/minishlink-web-push)[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

2587.7M12](/packages/laravel-notification-channels-twilio)[spatie/url-signer

Generate a url with an expiration date and signature to prevent unauthorized access

4422.3M16](/packages/spatie-url-signer)[mattketmo/email-checker

Throwaway email detection library

2742.0M5](/packages/mattketmo-email-checker)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)

PHPackages © 2026

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