adevesa/laravel-simple-otp
最新稳定版本:1.0.2
Composer 安装命令:
composer require adevesa/laravel-simple-otp
包简介
Generate and validate OTPs for your applications
README 文档
README
This package is a simple OTP generator for Laravel. You can use it to generate OTPs and validate them.
Installation
You can install the package via composer:
composer require adevesa/laravel-simple-otp
You can publish and run the migrations and publish the config file with:
php artisan vendor:publish --provider="adevesa\SimpleOTP\SimpleOTPServiceProvider"
php artisan migrate
This is the contents of the published config file:
return [ 'otp_length' => env('SIMPLE_OTP_LENGTH', 6), 'otp_format' => env('SIMPLE_OTP_FORMAT', 'alpha_numeric'), 'otp_expiration_minutes' => env('SIMPLE_OTP_EXPIRATION_MINUTES', 5), 'otp_max_attempts' => env('SIMPLE_OTP_MAX_ATTEMPTS', 3), 'otp_throw_exceptions' => env('SIMPLE_OTP_THROW_EXCEPTIONS', true), ];
With the otp_throw_exceptions option you can control if the package should throw exceptions or return false when an OTP is not valid.
Usage
$simpleOTP = new adevesa\SimpleOTP(); $code = $simpleOTP->create('a_email@example.com'); $simpleOTP->verify('a_email@example.com', "ASD123");
Or also
$code = \adevesa\SimpleOTP\Facades\SimpleOTP::create('+5491123456789')->code; $isValid = \adevesa\SimpleOTP\Facades\SimpleOTP::verify('+5491123456789', $code);
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
If you discover any security-related issues, please email adevesa95@outlook.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 1.48k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-01-31