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

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

alish/laravel-otp
=================

My awesome package

v0.2.5(5y ago)0205MITPHPPHP ^7.4|^8

Since Nov 10Pushed 5y ago1 watchersCompare

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

READMEChangelogDependencies (4)Versions (11)Used By (0)

Laravel Module to Facilitate the One-Time Password Authentication
=================================================================

[](#laravel-module-to-facilitate-the-one-time-password-authentication)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c853af9f2973af05056e0510ff494ad0972b6c7ce9b27651b22846967fd0bcb4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616c6973682f6c61726176656c2d6f74702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/alish/laravel-otp)[![Build Status](https://camo.githubusercontent.com/8bc0c479de9da13599ac96bca8b58e2302c0da922c0bec95f4435575dd06f912/68747470733a2f2f6170692e7472617669732d63692e6f72672f6264702d7261796d6f6e2f6c61726176656c2d6f74702e7376673f6272616e63683d6d61696e)](https://travis-ci.org/bdp-raymon/laravel-otp)[![Quality Score](https://camo.githubusercontent.com/cf42cd685ab42f572d22b0303f8fef4a03b85b44e44ed3b31fecdccc7d794007/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6264702d7261796d6f6e2f6c61726176656c2d6f74702e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/bdp-raymon/laravel-otp)[![Total Downloads](https://camo.githubusercontent.com/656bd8af505adffa2800784cf00c9ebb910f25848540ab9b59e9e52f3cc6009a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616c6973682f6c61726176656c2d6f74702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/alish/laravel-otp)

One-Time Password Authentication has gained noticeable popularity amongst software developers, due to its reliablity and ease of use. Using this module, you are able to embedd OTP to your Laravel project in a considerably straightforward manner. This Package is equipped with both Cache and Database drivers to provide developers with the freedom of choice, regarding the unit supposed to hold the OTP and other related information.

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

[](#installation)

You can install the package via composer:

```
composer require alish/laravel-otp
```

Usage
-----

[](#usage)

for issuing new token for specific key:

```
$token = Otp::issue($key = "string");
```

to revoke token for specific key you can use:

```
$bool = Otp::revoke($key = 'string'); // return true if a valid provided key revoked
```

to check token against key:

```
$bool = Otp::check($key = 'string', $token = 'already issued token'); // if key and token match return true
```

if you want to use otp generated token (it means check provided key, token then revoke if it matches) you can:

```
$bool = Otp::use($key = 'string', $token = 'already issued token'); // return true if provided key, token match
```

Keep in mind that if database driver is your preferred choice, you are supposed to publish migrations file first:

```
php artisan vendor:publish --provider="Alish\LaravelOtp\OtpServiceProvider" --tag=migrations
```

then run your migrations with

```
php artisan migrate
```

In order to be able to adjust the configuration of this package, you are supposed to publish your configurations using the following command:

```
php artisan vendor:publish --provider="Alish\LaravelOtp\OtpServiceProvider" --tag=config
```

- default: Using this value, you are able to modify the default method to store the OTP and other related information.
- type: This variable determines the type of the characters included in the OTP. Choices are alpha, alphanumeric, numeric and strong (include special characters).
- length: By changing this variable, you are able to determine the number of the characters that OTP has.
- case-sensitive: Using this variable, you are able to control the sensitivity of the package to case sensitivity.
- custom': Pass the set of the characters you want to create your custom OTPs from as a simple string (eg: "1234") to this variable.
- timeout: This variable determines the time (in seconds), which the token is active to use. To set a token active permenantly, set timeout to null.
- hash: Using this variable, you are able to determine if the token should be hashed or not.
- unique: Using this variable, you are able to revoke all generated tokens after creating a new one, for a specific key. This functionality is only available for Database Driver.

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

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

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Ali Shabani](https://github.com/alish)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

Laravel Package Boilerplate
---------------------------

[](#laravel-package-boilerplate)

This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 91.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 ~13 days

Recently: every ~24 days

Total

8

Last Release

1963d ago

PHP version history (2 changes)v0.1.0PHP ^7.4

v0.2.5PHP ^7.4|^8

### Community

Maintainers

![](https://www.gravatar.com/avatar/216bcba65e7ebc9c9669dc6629806763ccfbe39b5b40d898e710dbacfcba6faa?d=identicon)[pyramidalish](/maintainers/pyramidalish)

---

Top Contributors

[![ali-shabani](https://avatars.githubusercontent.com/u/12711392?v=4)](https://github.com/ali-shabani "ali-shabani (21 commits)")[![amirberenji1995](https://avatars.githubusercontent.com/u/62798672?v=4)](https://github.com/amirberenji1995 "amirberenji1995 (2 commits)")

---

Tags

laravel otpalish

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

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

The official AI SDK for Laravel.

1.0k3.2M193](/packages/laravel-ai)[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8793.2M25](/packages/yajra-laravel-oci8)[mike-bronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k90.5k1](/packages/mike-bronner-laravel-model-caching)[fouladgar/laravel-otp

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

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

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45444.2k1](/packages/pressbooks-pressbooks)

PHPackages © 2026

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