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

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

fleetfoot/otp
=============

Laravel5 OTP manager

193.7k9[3 issues](https://github.com/Oviyum/laravel-otp/issues)[1 PRs](https://github.com/Oviyum/laravel-otp/pulls)PHP

Since Dec 2Pushed 4y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

laravel-otp
===========

[](#laravel-otp)

Laravel 5 OTP Generation.

The module generates OTPs and validates them. You can plug your own notifier (such as AWS SNS) to send the OTPs to various channels.

Several configuration options are provided:

- Expiration duration
- Maximum OTPs allowed for a client during the expiration time
- Length of OTP
- Blacklisting clients
- Dafault length of OTP
- Allowed validation OTP attempts
- Validation OTP attempts count time

---

Installation
============

[](#installation)

### Via composer

[](#via-composer)

1. Run `composer require fleetfoot/otp`
2. Add `Fleetfoot\OTP\OTPServiceProvider` to your providers array in `config/app.php`
3. Run `composer dump-autoload`
4. Run `php artisan vendor:publish`
5. Run `php artisan migrate`

Done!

---

Configuration options
=====================

[](#configuration-options)

The package publishes `config/otp.php`. It is well documented.

---

Usage
=====

[](#usage)

The package provides with the following helpers:

1. `Manager`
2. `Generator`
3. `Validator`

You can use `Manager` to interact with the whole module. It acts as a wrapper for the complete functionality. However, you are free to use other helpers to generate and validate the OTPs.

### Generate an OTP

[](#generate-an-otp)

To generate an OTP, call `generate` method of `Manager`. This takes two mandatory arguments: module and ID. Both are strings. You can pass anything here, but keep in mind that this combination will be used to validate the OTP. For e.g. `$manager->generate('users', '1')` will return an OTP for the combination of 'users' module and ID '1'. If you want change default OTP length you can set optional third param `$manager->generate('users', '1', 6)`

### Validate an OTP

[](#validate-an-otp)

To validate, call `isValid()` of the manager. It will return boolean based on the validity of the OTP. Validation makes sure the module + ID is not blocked, the token is not expired and validation attemts is not еxceeded

### Blocking and Unblocking

[](#blocking-and-unblocking)

You won't be able to validate OTP and generate anymore OTPs for blocked module + ID combination.

To block use: `$manager->block('users', '1')`

To unblock use: `$manager->unblock('users', '1')`

### Notifications

[](#notifications)

The manager gives `notify()` method which accepts any implementation of `Notifier` interface. You can implement this interface as per your business logic.

You might want to call `useOtp()` of the manager after the varification process completes. If you do not call this method, OTP will remain valid till it reaches its expiry limit.

### Clean outdated OTPs and validation attemps

[](#clean-outdated-otps-and-validation-attemps)

You can clean up outdated OTPs and validation attempts by running: `php artisan otp:clean`

You can do it in schedule: `$schedule->command('otp:clean')->daily();`

---

Contributions
=============

[](#contributions)

All contributions are welcome! Create a fork, create PRs, discuss!

---

TODO
====

[](#todo)

1. Add option for numeric/alphanumeric code generation
2. Provide example implementation(s) for Notifier
3. Find a better way to remove expired OTPs from DB

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity28

Early-stage or recently created project

 Bus Factor1

Top contributor holds 60% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/666bda0b83a25180603e4a79731ebc70c0c162045c33bdb090c9777619bdf38c?d=identicon)[codingquark](/maintainers/codingquark)

---

Top Contributors

[![BagriyDmitriy](https://avatars.githubusercontent.com/u/13766285?v=4)](https://github.com/BagriyDmitriy "BagriyDmitriy (9 commits)")[![dhavan-oviyum](https://avatars.githubusercontent.com/u/146936801?v=4)](https://github.com/dhavan-oviyum "dhavan-oviyum (2 commits)")[![codingquark](https://avatars.githubusercontent.com/u/456712?v=4)](https://github.com/codingquark "codingquark (1 commits)")[![donmbelembe](https://avatars.githubusercontent.com/u/10473277?v=4)](https://github.com/donmbelembe "donmbelembe (1 commits)")[![gildo](https://avatars.githubusercontent.com/u/133645?v=4)](https://github.com/gildo "gildo (1 commits)")[![rakib-09](https://avatars.githubusercontent.com/u/11966280?v=4)](https://github.com/rakib-09 "rakib-09 (1 commits)")

### Embed Badge

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

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

###  Alternatives

[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)[beatswitch/lock

A flexible, driver based Acl package for PHP 5.4+

870304.7k2](/packages/beatswitch-lock)[amocrm/amocrm-api-library

amoCRM API Client

182728.5k6](/packages/amocrm-amocrm-api-library)[vonage/jwt

A standalone package for creating JWTs for Vonage APIs

424.1M4](/packages/vonage-jwt)

PHPackages © 2026

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