PHPackages                             fisal/laravel-otp - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. fisal/laravel-otp

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

fisal/laravel-otp
=================

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

v1.0.3(4mo ago)0308MITPHPPHP ^8.1|^8.2|^8.3|^8.4|^8.5|^8.6|^8.7|^8.8|^8.9|^9.0

Since Feb 12Pushed 4mo agoCompare

[ Source](https://github.com/muuFisal/fisal-laravel-otp)[ Packagist](https://packagist.org/packages/fisal/laravel-otp)[ Docs](https://mohamed-fisal.com/)[ RSS](/packages/fisal-laravel-otp/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (5)Versions (5)Used By (0)

fisal/laravel-otp
=================

[](#fisallaravel-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
------------

[](#installation)

```
composer require fisal/laravel-otp:^1.0
```

Configuration (optional)
------------------------

[](#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
-----

[](#usage)

### Generate OTP

[](#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)

[](#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)

[](#boolean-check-does-not-consume)

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

Artisan
-------

[](#artisan)

Clean invalid and expired OTPs:

```
php artisan otp:clean
```

License
-------

[](#license)

MIT

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance74

Regular maintenance activity

Popularity11

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

4

Last Release

140d ago

PHP version history (2 changes)v1.0.0PHP ^8.1|^8.2|^8.3|^8.4

v1.0.3PHP ^8.1|^8.2|^8.3|^8.4|^8.5|^8.6|^8.7|^8.8|^8.9|^9.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/6aba5e0ecbb2807c673f4c51006e14686672a6c74a65772d648356bd009b2c5b?d=identicon)[muuFisal](/maintainers/muuFisal)

---

Top Contributors

[![muuFisal](https://avatars.githubusercontent.com/u/117264935?v=4)](https://github.com/muuFisal "muuFisal (1 commits)")

---

Tags

laravelotp2faverificationone-time-password2factor

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/fisal-laravel-otp/health.svg)

```
[![Health](https://phpackages.com/badges/fisal-laravel-otp/health.svg)](https://phpackages.com/packages/fisal-laravel-otp)
```

###  Alternatives

[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.6k29.9M146](/packages/laravel-cashier)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k15.1M132](/packages/laravel-pulse)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k95.4M305](/packages/laravel-horizon)[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8793.2M25](/packages/yajra-laravel-oci8)[fouladgar/laravel-otp

This package provides convenient methods for sending and validating OTP notifications to users for authentication.

21227.6k](/packages/fouladgar-laravel-otp)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
