alrez96 / laravel-otp
OTP login system for the Laravel framework.
Installs: 9
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/alrez96/laravel-otp
Requires
- php: ^8.2
- laravel/framework: ^11.0
Requires (Dev)
- orchestra/testbench: ^9.0
- phpunit/phpunit: ^11.0
This package is auto-updated.
Last update: 2025-10-11 12:30:01 UTC
README
Introduction
This is a simple package for implementing the OTP system in Laravel, which only includes generating the token and validating it. You can use this package alongside Laravel's authentication system or the laravel/breeze package.
Installation
You can install the package via composer:
composer require alrez96/laravel-otp
Configuration
You should publish the migration and the config/otp.php config file with:
php artisan vendor:publish --provider="Alrez96\LaravelOtp\OtpServiceProvider"
Usage
Generate OTP Token
<?php use Alrez96\LaravelOtp\Facades\Otp; Otp::generateToken(string $identifier); // or using helper otp()->generateToken(string $identifier);
Validate OTP Token
<?php use Alrez96\LaravelOtp\Facades\Otp; Otp::validateToken(string $identifier, string $token); // or using helper otp()->validateToken(string $identifier, string $token);
License
This package is open-sourced software licensed under the MIT license.