circlesandlambdas / larotp
An OTP generation and Verification Laravel Package using RFC standards.
Requires
- php: ^8.2
- illuminate/database: ^10.0
- illuminate/notifications: ^10.0
- illuminate/support: ^10.0|^11.0
Requires (Dev)
- laravel/pint: dev-main
- orchestra/testbench: ^8.0|^9.0
- phpunit/php-code-coverage: ^10.0|^11.0
- phpunit/phpunit: ^10.0|^11.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is not auto-updated.
Last update: 2026-11-10 06:16:42 UTC
README
LarOTP allows you to create and verify cryptographically secure one-time passwords (OTP). The package also allows for the OTP to be sent through email. The generation is done through RFC standards, mainly RFC 6238 (TOTP) and RFC 4226 (HOTP)
How It Works
The package uses Concerns to attach itself to any model you would like to authenticate. Here is how a typical flow would look like
use circlesandlambdas\larotp\Models\Concerns\LarOTP; \\LarOTP package use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; use Laravel\Sanctum\HasApiTokens; class User extends Authenticatable { use HasApiTokens, HasFactory, Notifiable, LarOTP; // Attach LarOTP to user model // Rest of code }
To protect a route using LarOTP, a middleware larotp:keeper is applied to the routes, and every request to the route will be checked for authenticity.
Route::middleware(['larotp.keeper'])->group(function(){ Route::get('/dashboard', [App\Http\Controllers\Dashboard::class, 'index'])->name('dashboard'); });
The final version will include a DIY approach to enable flexibility on your project .e.g use LarOTP as a login method
$user->generateTOTP();
Current Progress
- HOTP and TOTP algorithms successfully implemented.
- Laravel session management, Notification and Rate limiting implemented
- Unit testing (for the algorithms) successfully implemented. Feature testing will continue to ensure the package performs optimally
Contributing Members
Kevin Andeka andeka.kev@gmail.com : Github: Lambda1001
License
The MIT License (MIT). Please see License File for more information.
