Package Data | |
---|---|
Maintainer Username: | mrlian |
Maintainer Contact: | 479245760@qq.com (WenJunLian) |
Package Create Date: | 2015-09-21 |
Package Last Update: | 2017-10-09 |
Home Page: | |
Language: | PHP |
License: | Unknown |
Last Refreshed: | 2024-12-19 03:13:38 |
Package Statistics | |
---|---|
Total Downloads: | 7 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 1 |
Total Watchers: | 1 |
Total Forks: | 0 |
Total Open Issues: | 0 |
目前接入平台有LuosiMao&YunPian后期将扩展其它平台
Require this package with composer:composer require mrlian/smsservice
Find the providers
key in config/app.php
and register the SmsService Service Provider.
'providers' => [
// ...
'Mrlian\Smsservice\SmsserviceServiceProvider',
]
Find the aliases key in config/app.php
.
'aliases' => [
// ...
'SmsService' => 'Mrlian\Smsservice\Vendor\SmsService',
]
To use your own settings, publish config.
$ php artisan config:publish mrlian/smsservice
Find the config in config/packages/mrlian/smsservice/config.php.
实例化一个短信平台.
$sms = SmsService::factory('YunPian');
$sms->sendSmsCode('yourPhoneNum', 'verificationCode');
可用方法:
$sms->getCode();
返回短信商信息代码0表示发送成功,其它代码自行查阅$sms->getMsg();
返回短信商反馈信息异常:(用于短信发送失败后切换平台)
$sms = SmsService::factory('LuosiMao');
$sms->sendSmsCode('yourPhoneNum', 'verificationCode');
try {
$sms->getCode();
} catch (Mrlian\Smsservice\Vendor\SmsException $e) {
$sms = SmsService::factory('YunPian');
}