PHPackages                             chrysanthos/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. chrysanthos/laravel-otp

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

chrysanthos/laravel-otp
=======================

Login Otp for Laravel

2.0.7(10mo ago)31.7k1MITBladePHP ^8.2CI passing

Since Nov 29Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/chrysanthos/laravel-otp)[ Packagist](https://packagist.org/packages/chrysanthos/laravel-otp)[ Docs](https://github.com/chrysanthos/laravel-otp)[ RSS](/packages/chrysanthos-laravel-otp/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (13)Versions (30)Used By (0)

Login Otp for Laravel
=====================

[](#login-otp-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/eb07c3c6515c2d281ece74999fedac641f01fcf1d455f0d35080b035cd55c70e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6368727973616e74686f732f6c61726176656c2d6f74702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/chrysanthos/laravel-otp)[![GitHub Tests Action Status](https://camo.githubusercontent.com/1d32c2fc5b470ebdce57aae81184a16b8393ba174cf67029cbd7ca5662a31f5e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6368727973616e74686f732f6c61726176656c2d6f74702f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473)](https://github.com/chrysanthos/laravel-otp/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/4e674d747d3b61e4536f76cae561b7f8dcf085779732899c1033aebe4e82a68c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6368727973616e74686f732f6c61726176656c2d6f74702f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65)](https://github.com/chrysanthos/laravel-otp/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/3130f53edf7797f5162ffaeb80eb5c628a17b44960cbf132c509c3efaa3d9306/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6368727973616e74686f732f6c61726176656c2d6f74702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/chrysanthos/laravel-otp)

This package lets you set up an OTP verification process upon user login.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require chrysanthos/laravel-otp
```

You can publish the config file with:

```
php artisan vendor:publish --tag="laravel-otp-config"
```

There are the contents of the published config file:

```
return [

    /**
     * Whether the package will register the routes and listeners.
     */
    'enabled' => false,

    /**
     * The logo image to be shown above otp input.
     */
    'logo' => null,

    /**
     * The notification to be sent to the logged-in user.
     * Override this with your own implementation so that
     * you can customize the channels, message format etc.
     */
    'notification' => \Chrysanthos\LaravelOtp\Notifications\SendOtpToUserNotification::class,

    /**
     * The paths that should be protected by otp. This must be
     * relative paths with no slashes at the start of the string.
     * Use this option in case you have admin login area with tools
     * like Nova/Backpack/Filament and only nedd otp in the main site
     *
     * Sadly the paths must point to the uri path of the route that the login form is submitted to.
     */
    'paths' => [
        '*',
    ],
];
```

Optionally, you can publish the login view using

```
php artisan vendor:publish --tag="laravel-otp-views"
```

Usage
-----

[](#usage)

Add the RedirectToOtpPage Middleware to the routes you wish to be protected by OTP.

```
use Chrysanthos\LaravelOtp\Middleware\RedirectToOtpPage;

Route::middleware([
    'auth:sanctum',
    RedirectToOtpPage::class,
])->group(function () {
    Route::get('/dashboard', DashboardController::class);
});
```

You may customize the notification by changing the `notification` key in the config. By setting the notification to a custom notification class you have full flexibility on how the notification is sent (Channels, Text, etc.)

```
'notification' => \App\Notifications\YourCustomNotification::class,
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please contact me directly via email.

Credits
-------

[](#credits)

- [Chrysanthos Prodromou](https://github.com/chrysanthos)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

48

—

FairBetter than 94% of packages

Maintenance75

Regular maintenance activity

Popularity23

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 98.3% 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 ~35 days

Recently: every ~91 days

Total

28

Last Release

305d ago

Major Versions

0.2.0 → 1.0.02023-10-08

1.0.1 → 2.0.02024-03-24

PHP version history (6 changes)0.0.1PHP ^8.1

0.2.0PHP ^8.1.0|^8.2.0

1.0.0PHP ^8.1|^8.2

2.0.0PHP ^8.1|^8.2|^8.3

2.0.2PHP ^8.1|^8.2|^8.3|^8.4

2.0.3PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/9e4c6e7361079cf5c5ac78f42bcfaeed5547826c3a81c682ccbbe40c04dc397c?d=identicon)[chrysanthos](/maintainers/chrysanthos)

---

Top Contributors

[![chrysanthos](https://avatars.githubusercontent.com/u/48060191?v=4)](https://github.com/chrysanthos "chrysanthos (57 commits)")[![gregkos](https://avatars.githubusercontent.com/u/6676236?v=4)](https://github.com/gregkos "gregkos (1 commits)")

---

Tags

hacktoberfestlaravellaravel-authlaravel-authenticationlaravel-frameworklaravel-otplaravel-packageotpphpphp-otplaravellaravel otpChrysanthos

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k89.8M1.0k](/packages/spatie-laravel-permission)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[jeffgreco13/filament-breezy

A custom package for Filament with login flow, profile and teams support.

1.0k1.7M41](/packages/jeffgreco13-filament-breezy)[spatie/laravel-login-link

Quickly login to your local environment

4381.2M1](/packages/spatie-laravel-login-link)[ryangjchandler/laravel-cloudflare-turnstile

A simple package to help integrate Cloudflare Turnstile.

438896.6k2](/packages/ryangjchandler-laravel-cloudflare-turnstile)[spatie/laravel-passkeys

Use passkeys in your Laravel app

444494.4k16](/packages/spatie-laravel-passkeys)

PHPackages © 2026

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