定制 wasento/package-wasento-otp 二次开发

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

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

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-09-05