rytescube/otpkit
Composer 安装命令:
composer require rytescube/otpkit
包简介
Laravel package to generate otp or one time password
README 文档
README
Laravel package to generate otp or one time password.
Installation
In Laravel 5.5+ otpkit will install via the new package discovery feature so you only need to add the package to your composer.json file
composer require rytescube/otpkit
after installation you should see
Discovered Package: rytescube/otpkit
and you are ready to go
Basic Usage
For quick generation of an OTP just do
Otp::generate();
This will generate a numeric OTP having length 4.
Advanced Usage
OTP generation
Generate an OTP using three variant. You can set the length of the OTP. If not supplied it will generate an OTP having default length 4.
Otp::generate($type,$length);
| Params | Value | Description | Example |
|---|---|---|---|
| $type | Otp::ALPHA |
Generates only alphabetic characters type OTP | Otp::generate(Otp::ALPHA); //AXBZ |
Otp::NUM (Default) |
Generates only numeric type OTP | Otp::generate(Otp::NUM); //1234 |
|
Otp::ALPHA_NUM |
Generates mix of alphabetic characters & numeric type OTP | Otp::generate(Otp::ALPHA_NUM); //1A3D |
|
| $length | 4 (Default) | 5 | 6 | Decides the length of the OTP. | Otp::generate(Otp::ALPHA_NUM,5); //2X8DT |
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-05-12