New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

fisal/laravel-otp

A simple package to generate and validate OTPs (internal fork with improvements)
1,016 1

Larablocks Analysis

fisal/laravel-otp works with Laravel 9 to 13 (latest release v1.0.3, Feb 13, 2026).

Promising: maintained and up to date, meets 2 of 4 checks; not yet widely used.

  • Works with Laravel 13, the current version
  • Released in the last 12 months (Feb 13, 2026)
  • 113 downloads a month (needs 10,000)
  • 1 GitHub star (needs 100)

State

Maintained
  • Last stable release: Feb 13, 2026.
  • 4 releases in the last 12 months.
  • First released: Feb 12, 2026.
  • Monthly downloads: 113.
  • 0 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Nov 30, 2026.

Install
composer require fisal/laravel-otp
Latest Version:v1.0.3
PHP:^8.1|^8.2|^8.3|^8.4|^8.5|^8.6|^8.7|^8.8|^8.9|^9.0
Laravel:9 – 13
License:MIT
Last Updated:Feb 13, 2026
Links: GitHub  ·  Packagist
Maintainer: muuFisal

fisal/laravel-otp

A lightweight Laravel package to generate and validate one-time passwords (OTPs).

This is a maintained fork intended for real projects: it adds OTP type binding (e.g. login, 2fa) and an attempts limit.

Installation

composer require fisal/laravel-otp:^1.0

Configuration (optional)

Publish config (optional):

php artisan vendor:publish --tag=otp-config

Then you can control max attempts via:

  • config/otp.php
  • or env: OTP_MAX_ATTEMPTS=5

Usage

Generate OTP

use Otp;

// tokenType: numeric | alpha_numeric
// otpType: purpose binding (login | 2fa | reset_password | ...)
$result = Otp::generate(
    identifier: '201001234567',
    tokenType: 'numeric',
    length: 6,
    validity: 5,
    otpType: 'login'
);

$token = $result->token;

Validate OTP (consumes on success)

$result = Otp::validate(
    identifier: '201001234567',
    token: '123456',
    otpType: 'login'
);

if ($result->status) {
    // valid
} else {
    // invalid / expired
    // optional: $result->remaining_attempts
}

Boolean check (does NOT consume)

$isValid = Otp::isValid('201001234567', '123456', 'login');

Artisan

Clean invalid and expired OTPs:

php artisan otp:clean

License

MIT

Alternatives to fisal/laravel-otp

pragmarx/google2fa

A One Time Password Authentication package, compatible with Google Authenticator...

146,513,947 2,012
tzsk/otp

A secure, database-free One-Time Password (OTP) generator and verifier for PHP a...

738,785 241
pushery/email-magic-link-for-laravel

Passwordless email magic-link and OTP sign-in for Laravel, standalone or with Fo...

18,767 47
rstacode/otpiq

A Laravel package for handling OTP verification, The most reliable SMS & WhatsAp...

1,794 6
jeffersongoncalves/filament-multifactor-whatsapp

Filament 5 multi‑factor authentication via WhatsApp one‑time codes, with optiona...

2,215 17

Version History

Version Released PHP Laravel License
v1.0.3 ^8.1|^8.2|^8.3|^8.4|^8.5|^8.6|^8.7|^8.8|^8.9|^9.0 ^9.0|^10.0|^11.0|^12.0|^13.0 MIT
v1.0.2 ^8.1|^8.2|^8.3|^8.4 ^9.0|^10.0|^11.0 MIT
v1.0.1 ^8.1|^8.2|^8.3|^8.4 ^9.0|^10.0|^11.0 MIT
v1.0.0 ^8.1|^8.2|^8.3|^8.4 ^9.0|^10.0|^11.0 MIT