Skip to content

aliwebto/otp

Repository files navigation

Laravel OTP Authentication package for iranian

Latest Version on Packagist Total Downloads GitHub Actions

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 [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

With this package you can easily handle OTP login/register in laravel for iraninas

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages