aliwebto / otp
Laravel OTP Authentication Package
v1.0.1
2023-07-22 01:28 UTC
Requires
- php: ^7.4|^8.0
- ext-soap: *
- illuminate/support: ^8.0|^9.0|^10.0
Requires (Dev)
- laravel/pint: ^1.10
- orchestra/testbench: ^6.28
- pestphp/pest: ^1.23
- phpunit/phpunit: ^9.0
README
With this package you can easily handle OTP login/register in laravel .
Installation
You can install the package via composer:
composer require aliwebto/otp
php artisan vendor:publish --provider="Aliwebto\Otp\OtpServiceProvider"
php artisan migrate
Usage
use Aliwebto\Otp\Otp; // generate and send code Otp::generate("09xxxxxxxxx"); // check entered code Otp::check("code","09xxxxxxxxx"); // regenerate and send new code Otp::regenerate("09xxxxxxxxx"); // get regenerate code cooldown in seconds $code = Otp::lastCode("09xxxxxxxxx"); $seconds = Otp::regenerateCooldown($code); // check code and login/register $createUserIfNotExist = true; $newUserEmail = random_int(100000,9999999)."@aliwento.com"; $newUserName = "User"; $isLoggedIn = Otp::authenticate("CODE","09xxxxxxxxx",$createUserIfNotExist,$newUserEmail,$newUserName);
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email aliwebto@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.