donnie / msg91-php
此包最新版本(v1.0)没有可用的许可信息。
处理 msg91 短信和 OTP
v1.0
2018-09-06 06:59 UTC
Requires
- php: ^5.3.3 || ^7.0
This package is auto-updated.
Last update: 2024-09-07 00:32:40 UTC
README
PHP Composer 包用于 Msg91。严格遵循 PSR 标准。
安装
- 将此仓库添加到您的 composer.json 文件中。
,
"repositories": [
{
"type": "vcs",
"url": "https://git@github.com/Donnie/Msg91-PHP"
}
]
- 并在 composer.json 中要求
,
"require": {
"donnie/msg91-php": "dev-master"
}
- 运行
composer update
OTP 使用方法
use Donnie\Msg91\OTP;
// set your auth key and your sending name
$otp = new OTP('12234..your-authkey...1234', 'MYBIZN');
发送 OTP
// numbers must have country code
// country code may or may not have + sign in the beginning
// numbers may or may not have zero in the beginning
// in absence of country code by default 91 would be added
$otp->set('919998888777', 'jimkirk@starfleet.com', '320')->send();
// email argument is optional
// third argument is for template ID, optional
// this will send to phone and email
// to send SMS to numbers other than Indian you will need clearance from Msg91 first
重发 OTP
// default for second arg is 'voice'
$otp->resend('919998888777', 'text')->send();
验证 OTP
// to verify add phone and code
$res = $otp->get('919998888777', '6984')->send();
// you can read the outcome from $res->type (error || success)