Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yiier/yii2-smser
smser for Yii2
https://github.com/yiier/yii2-smser
yii2-extension yii2-sms yii2-smser
Last synced: about 23 hours ago
JSON representation
smser for Yii2
- Host: GitHub
- URL: https://github.com/yiier/yii2-smser
- Owner: yiier
- Created: 2018-01-23T08:47:21.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-06-14T10:55:35.000Z (over 6 years ago)
- Last Synced: 2024-04-14T09:58:38.246Z (10 months ago)
- Topics: yii2-extension, yii2-sms, yii2-smser
- Language: PHP
- Size: 5.86 KB
- Stars: 5
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-yii2 - yiier/yii2-smser
README
sms for Yii2
============
sms for Yii2[![Latest Stable Version](https://poser.pugx.org/yiier/yii2-smser/v/stable)](https://packagist.org/packages/yiier/yii2-smser)
[![Total Downloads](https://poser.pugx.org/yiier/yii2-smser/downloads)](https://packagist.org/packages/yiier/yii2-smser)
[![Latest Unstable Version](https://poser.pugx.org/yiier/yii2-smser/v/unstable)](https://packagist.org/packages/yiier/yii2-smser)
[![License](https://poser.pugx.org/yiier/yii2-smser/license)](https://packagist.org/packages/yiier/yii2-smser)Installation
------------The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
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
```shell
$ php yii migrate --migrationPath=@yiier/smser/migrations/
```Usage
-----Once the extension is installed, simply modify your application configuration as follows:
```php
[
'smser' => [
'class' => 'yiier\smser\Smser',
'config' => [
'gateways' => [
// 云片网
'yunpian' => [
'api_key' => 'xxxxxxxxxxxxxxxxxxxxxxxxx',
],
],
]
]
]
];
```More detail [overtrue/easy-sms 使用](https://github.com/overtrue/easy-sms#%E4%BD%BF%E7%94%A8)
Validator
```php
'Signup'],
];
}
}
```send code && update code status
```php
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);
```