wasento/package-wasento-otp
Composer 安装命令:
composer require wasento/package-wasento-otp
包简介
Package OtpWasento
关键字:
README 文档
README
An OTP, or one-time password, is a randomly generated password that is sent to the user's device, such as their phone or computer, via WhatsApp, just before they log in to an account. OTPs are a type of two-factor authentication (2FA), which means that they require two different pieces of information to verify the user's identity. The first piece of information is usually the user's username and password, and the second piece of information is the OTP.
Installation
composer require wasento/package-wasento-otp
Get countries
use WASENTO\OtpWasento\{OtpWasentoApi, OtpWasentoConfig }; OtpWasentoConfig::$api = 'YOUR_API_KEY'; $results = (new OtpWasentoApi)->countries(); var_dump($results);
Sample Response:
stdClass Object ( [success] => 1 [message] => success [results] => Array ( [0] => stdClass Object ( [name] => Afghanistan [alpha-2] => AF [country-code] => 004 ) ... ) )
Request OTP
use WASENTO\OtpWasento\{OtpWasentoApi, OtpWasentoConfig }; OtpWasentoConfig::$api = 'YOUR_API_KEY'; $results = (new OtpWasentoApi)->requestOtp('081xxxxxxxx','ID','{code} is your OTP'); var_dump($results);
Sample Response:
stdClass Object ( [success] => 1 [message] => success [results] => c442f0d92c0fec0d7a4414fc83323942 )
Verify OTP
use WASENTO\OtpWasento\{OtpWasentoApi, OtpWasentoConfig }; OtpWasentoConfig::$api = 'YOUR_API_KEY'; $results = (new OtpWasentoApi)->verifyOtp('c442f0d92c0fec0d7a4414fc83323942','418639'); var_dump($results);
Sample Response:
stdClass Object ( [success] => 1 [message] => success [results] => )
NOTE:
- OTP code valid for 5 minutes. It`s mean user cannot request multiple times with same phone number before OTP code expired.
- Get your API Key here
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-09-05