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

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

adevesa/laravel-simple-otp
==========================

Generate and validate OTPs for your applications

1.0.2(2y ago)01.7k↓34.4%[4 PRs](https://github.com/adevesa/laravel-simple-otp/pulls)MITPHPPHP ^8.1CI passing

Since Jan 31Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/adevesa/laravel-simple-otp)[ Packagist](https://packagist.org/packages/adevesa/laravel-simple-otp)[ Docs](https://github.com/adevesa/laravel-simple-otp)[ GitHub Sponsors](https://github.com/adevesa)[ RSS](/packages/adevesa-laravel-simple-otp/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (13)Versions (8)Used By (0)

Laravel Simple OTP
==================

[](#laravel-simple-otp)

[![Latest Version on Packagist](https://camo.githubusercontent.com/71210b4ec62030a18dda98f5cfa75eda8ce9dfd18e696e6fbbff3b560793eb64/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616465766573612f6c61726176656c2d73696d706c652d6f74702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/adevesa/laravel-simple-otp)[![GitHub Tests Action Status](https://camo.githubusercontent.com/a36ec23b31c7c1c92b06ac345ab3bba674c2f93a5e7c645c54e962fc4ff8a547/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f616465766573612f6c61726176656c2d73696d706c652d6f74702f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/adevesa/laravel-simple-otp/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/d31f4abb284af1c9f077e55a0315662d04a1542753a62840b81188cb323dfd5b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f616465766573612f6c61726176656c2d73696d706c652d6f74702f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/adevesa/laravel-simple-otp/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/7576a3911ede4b0c3c9070d6f4ff637f4ae0dc4a220126a9b462b056da8e7795/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616465766573612f6c61726176656c2d73696d706c652d6f74702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/adevesa/laravel-simple-otp)

This package is a simple OTP generator for Laravel. You can use it to generate OTPs and validate them.

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

[](#installation)

You can install the package via composer:

```
composer require adevesa/laravel-simple-otp
```

You can publish and run the migrations and publish the config file with:

```
php artisan vendor:publish --provider="adevesa\SimpleOTP\SimpleOTPServiceProvider"
php artisan migrate
```

This is the contents of the published config file:

```
return [
    'otp_length' => env('SIMPLE_OTP_LENGTH', 6),
    'otp_format' => env('SIMPLE_OTP_FORMAT', 'alpha_numeric'),
    'otp_expiration_minutes' => env('SIMPLE_OTP_EXPIRATION_MINUTES', 5),
    'otp_max_attempts' => env('SIMPLE_OTP_MAX_ATTEMPTS', 3),
    'otp_throw_exceptions' => env('SIMPLE_OTP_THROW_EXCEPTIONS', true),
];
```

With the `otp_throw_exceptions` option you can control if the package should throw exceptions or return `false` when an OTP is not valid.

Usage
-----

[](#usage)

```
$simpleOTP = new adevesa\SimpleOTP();
$code = $simpleOTP->create('a_email@example.com');
$simpleOTP->verify('a_email@example.com', "ASD123");
```

Or also

```
$code = \adevesa\SimpleOTP\Facades\SimpleOTP::create('+5491123456789')->code;
$isValid = \adevesa\SimpleOTP\Facades\SimpleOTP::verify('+5491123456789', $code);
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

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

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

[](#contributing)

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

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

[](#security-vulnerabilities)

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

Credits
-------

[](#credits)

- [Devesa Agustín](https://github.com/adevesa)

License
-------

[](#license)

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

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance57

Moderate activity, may be stable

Popularity18

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 52.6% 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 ~0 days

Total

3

Last Release

885d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2d27d5612caeacc482ffcfda91c9d42a8c2fd434782590afc65dc950b9287890?d=identicon)[adevesa](/maintainers/adevesa)

---

Top Contributors

[![adevesa](https://avatars.githubusercontent.com/u/11793366?v=4)](https://github.com/adevesa "adevesa (20 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (10 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (8 commits)")

---

Tags

generatorlaravelotpsimplevalidatorlaravelotpPasswordlessadevesalaravel-simple-otp

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k102.4M1.4k](/packages/spatie-laravel-permission)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[spatie/laravel-passkeys

Use passkeys in your Laravel app

471890.7k39](/packages/spatie-laravel-passkeys)[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.1k11.2M100](/packages/dedoc-scramble)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[wnx/laravel-backup-restore

A package to restore database backups made with spatie/laravel-backup.

213421.0k2](/packages/wnx-laravel-backup-restore)

PHPackages © 2026

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