PHPackages                             seshac/otp-generator - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. seshac/otp-generator

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

seshac/otp-generator
====================

OTP Generator and Validator for Laravel Applications

0.0.8(2y ago)42157.5k—4%21[3 issues](https://github.com/seshac/otp-generator/issues)MITPHPPHP ^7.3|7.4|^8.0|^8.1|^8.2

Since Dec 12Pushed 2y ago3 watchersCompare

[ Source](https://github.com/seshac/otp-generator)[ Packagist](https://packagist.org/packages/seshac/otp-generator)[ Docs](https://github.com/seshac/otp-generator)[ GitHub Sponsors](https://github.com/seshac)[ RSS](/packages/seshac-otp-generator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (3)Versions (9)Used By (0)

OTP Generator and Validator for Laravel Applications
====================================================

[](#otp-generator-and-validator-for-laravel-applications)

[![Latest Version on Packagist](https://camo.githubusercontent.com/14d2eeba7010e27280f962a1dddad41e04ca6fdc419f2ca80852f41c6596c359/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7365736861632f6f74702d67656e657261746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/seshac/otp-generator)[![GitHub Tests Action Status](https://github.com/seshac/otp-generator/workflows/Tests/badge.svg)](https://github.com/seshac/otp-generator/workflows/Tests/badge.svg)[![Total Downloads](https://camo.githubusercontent.com/a08b11a2cc255c214dfce95be946a3ba145e072c85461ff756a346e372cbf6e0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7365736861632f6f74702d67656e657261746f722e7376673f3f7374796c653d666c61742d737175617265)](https://packagist.org/packages/seshac/laravel-shiprocket-api)

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

[](#installation)

You can install the package via composer:

```
composer require seshac/otp-generator
```

You can publish and run the migrations with:

```
php artisan vendor:publish --provider="Seshac\Otp\OtpServiceProvider" --tag="migrations"
php artisan migrate
```

You can publish the config file with:

```
php artisan vendor:publish --provider="Seshac\Otp\OtpServiceProvider" --tag="config"
```

Usage
-----

[](#usage)

```
use Seshac\Otp\Otp;
.
.
// May be you can use phone number as $identifier
$otp =  Otp::generate($identifier);
.
$verify = Otp::validate($identifier, $otp->token);
// example response
{
  "status": true
  "message": "OTP is valid"
}

// to get an expiredAt time
$expires = Otp::expiredAt($identifier);

// example response
{
 status: true
 expired_at: Illuminate\Support\Carbon @1611895244^ {
 date: 2021-01-29 04:40:44.0 UTC (+00:00)
}
```

You have control to update the setting at otp-generator.php config file but you control while generating also

Advance Usage
-------------

[](#advance-usage)

```
use Seshac\Otp\Otp;
.
.
$otp =  Otp::setValidity(30)  // otp validity time in mins
      ->setLength(4)  // Lenght of the generated otp
      ->setMaximumOtpsAllowed(10) // Number of times allowed to regenerate otps
      ->setOnlyDigits(false)  // generated otp contains mixed characters ex:ad2312
      ->setUseSameToken(true) // if you re-generate OTP, you will get same token
      ->generate($identifier);
.
$verify = Otp::setAllowedAttempts(10) // number of times they can allow to attempt with wrong token
    ->validate($identifier, $otp->token);
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

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

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

[](#contributing)

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

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

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [sesha](https://github.com/seshac)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity47

Moderate usage in the ecosystem

Community16

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 87.5% 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 ~149 days

Recently: every ~261 days

Total

8

Last Release

939d ago

PHP version history (3 changes)0.0.1PHP ^7.4|^8.0

0.0.2PHP ^7.3|7.4|^8.0

0.0.8PHP ^7.3|7.4|^8.0|^8.1|^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/c0217cc5be6c219ac30d336d1e4941417cb9c8ea8982e6fbdb4c663172f52d77?d=identicon)[sesha](/maintainers/sesha)

---

Top Contributors

[![seshac](https://avatars.githubusercontent.com/u/22927513?v=4)](https://github.com/seshac "seshac (28 commits)")[![rakeshlanjewar](https://avatars.githubusercontent.com/u/36743306?v=4)](https://github.com/rakeshlanjewar "rakeshlanjewar (3 commits)")[![sesha008](https://avatars.githubusercontent.com/u/35944087?v=4)](https://github.com/sesha008 "sesha008 (1 commits)")

---

Tags

laravelotp generatorseshac

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[highideas/laravel-users-online

This package will provide an online users management.

203113.2k1](/packages/highideas-laravel-users-online)[stephenjude/filament-blog

Filament Blog Builder

20317.8k](/packages/stephenjude-filament-blog)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[datomatic/nova-detached-actions

A Laravel Nova tool to allow for placing actions in the Nova toolbar detached from the checkbox selection mechanism.

11229.2k](/packages/datomatic-nova-detached-actions)

PHPackages © 2026

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