With this package you can easily handle OTP login/register in laravel .
You can install the package via composer:
composer require aliwebto/otp
php artisan vendor:publish --provider="Aliwebto\Otp\OtpServiceProvider"
php artisan migrate
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);
composer test
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email aliwebto@gmail.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.