Search by

An OTP generation and Verification Laravel Package using RFC standards.

Package info

github.com/Circles-and-Lambdas/LarOTP

pkg:composer/circlesandlambdas/larotp

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

dev-main 2026-06-02 04:56 UTC

This package is not auto-updated.

Last update: 2026-11-10 06:16:42 UTC


README

MIT Licensed Tests

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)

LarOTP System Components

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.