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

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

viezel/otp
==========

One Time Password for Laravel

1.0.0(5y ago)311MITPHPPHP ^7.4

Since Oct 23Pushed 5y ago1 watchersCompare

[ Source](https://github.com/viezel/otp)[ Packagist](https://packagist.org/packages/viezel/otp)[ Docs](https://github.com/viezel/otp)[ RSS](/packages/viezel-otp/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

One Time Password for Laravel
=============================

[](#one-time-password-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c177945a1bc743ba4f770816225caf61b0661e6488a13edb90f9b47ca11c5f29/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7669657a656c2f6f74702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/viezel/otp)[![GitHub Tests Action Status](https://camo.githubusercontent.com/07f761cfa06923659b69ce8d6c6dd747becf0898dcc2192e2adb4fa1c4036500/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f7669657a656c2f6f74702f54657374733f6c6162656c3d7465737473)](https://github.com/viezel/otp/actions?query=workflow%3Arun-tests+branch%3Amaster)[![Type Coverage](https://camo.githubusercontent.com/51c7e699afcf23b3373fa0897c5fafcc37c425b36d66249678b53a14ae2b7434/68747470733a2f2f73686570686572642e6465762f6769746875622f7669657a656c2f6f74702f636f7665726167652e737667)](https://shepherd.dev/github/viezel/otp)

This package is sending out a 6 digit verification code per email, when a user visits a route in your Laravel app. By default, the user identity verification will be valid for 30 minutes.

[![Verify](docs/component.png?raw=true "Verify")](docs/component.png?raw=true)

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

[](#installation)

1. Install the package via composer:

```
composer require viezel/otp
php artisan vendor:publish --provider="Viezel\OTP\OTPServiceProvider" --tag="migrations"
php artisan migrate
```

2. Add Middleware `check_otp` to the routes that should verify the User Identity.

```
Route::get('some/protected/route', MyController::class)->middleware(['auth', 'check_otp']);
Route::get('other/route', MyOtherController::class)->middleware(['auth', 'check_otp']);
```

Config
------

[](#config)

You can publish the config file with:

```
php artisan vendor:publish --provider="Viezel\OTP\OTPServiceProvider" --tag="otp-config"
```

```
return [
    /*
     * How long time in minutes should the verification code be valid for
     */
    'link_expires_in_minutes' => 300,

    /*
     * How long time in minutes should the user be verified for the certain route
     */
    'validation_expires_after_minutes' => 30,

    /*
     * Should be use the queue to sent out the verification email
     */
    'use_queue' => false,

    /*
     * Route Prefix
     */
    'route_prefix' => '',

    /*
     * Route Middleware
     */
    'route_middleware' => ['web', 'auth'],
];
```

### Customize

[](#customize)

You can build up your own verification view. Just publish the views and change what you need.

The package provides a blade component to reuse. Its based on Alpine.js and Tailwind CSS.

```

```

Testing
-------

[](#testing)

```
composer test
```

Credits
-------

[](#credits)

- [Mads Møller](https://github.com/viezel)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity53

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

Unknown

Total

1

Last Release

2028d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1e24155f0d3ab61799ca35477a940edce613075a20d1073f2241905271f29d23?d=identicon)[viezel](/maintainers/viezel)

---

Top Contributors

[![viezel](https://avatars.githubusercontent.com/u/312065?v=4)](https://github.com/viezel "viezel (19 commits)")

---

Tags

otp

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[spomky-labs/otphp

A PHP library for generating one time passwords according to RFC 4226 (HOTP Algorithm) and the RFC 6238 (TOTP Algorithm) and compatible with Google Authenticator

1.5k46.1M119](/packages/spomky-labs-otphp)[fouladgar/laravel-otp

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

21426.5k](/packages/fouladgar-laravel-otp)[salehhashemi/laravel-otp-manager

Laravel OTP manager

18713.2k](/packages/salehhashemi-laravel-otp-manager)[chillerlan/php-authenticator

A generator for counter- and time based 2-factor authentication codes (Google Authenticator). PHP 8.2+

58119.1k2](/packages/chillerlan-php-authenticator)[teckwei1993/laravel-otp

Laravel OTP generator and validation

5556.0k](/packages/teckwei1993-laravel-otp)[lakm/nopass

Provides passwordless authentication for your laravel projects.

2213.6k2](/packages/lakm-nopass)

PHPackages © 2026

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