定制 yiier/yii2-smser 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

yiier/yii2-smser

Composer 安装命令:

composer require yiier/yii2-smser

包简介

sms for Yii2

README 文档

README

sms for Yii2

Latest Stable Version Total Downloads Latest Unstable Version License

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist yiier/yii2-smser "*"

or add

"yiier/yii2-smser": "*"

to the require section of your composer.json file.

Migrations

Run the following command

$ php yii migrate --migrationPath=@yiier/smser/migrations/

Usage

Once the extension is installed, simply modify your application configuration as follows:

<?php
return [
    // something code
    'components' => [
        'smser' => [
            'class' => 'yiier\smser\Smser',
            'config' => [
                'gateways' => [
                    // 云片网
                    'yunpian' => [
                        'api_key' => 'xxxxxxxxxxxxxxxxxxxxxxxxx',
                    ],
                ],
            ]
        ]
    ]
];

More detail overtrue/easy-sms 使用

Validator

<?php
class SignupForm extends \yii\base\Model
{
    // something code
    public $verifyCode;

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            // something code
            // usage is Optional
            ['verifyCode', '\yiier\smser\validators\SmsCodeValidator', 'usage' => 'Signup'],
        ];
    }
}

send code && update code status

<?php
// send code
Yii::$app->smser->send(18688888888, [
    'content'  => '您的验证码为: 1234',
    'template' => 'SMS_001',
    'data' => ['code' => 1234, 'usage' => 'Signup'], // or 'data' => ['code' => 1234],
]);

// update used status 
\yiier\smser\models\SmsLog::used(18688888888, 1234);

统计信息

  • 总下载量: 30
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 3
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-4-Clause
  • 更新时间: 2018-01-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固