PHPackages                             prasanth-j/otpify - 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. prasanth-j/otpify

ActiveLibrary

prasanth-j/otpify
=================

Otpify is a Laravel package that provides a simple and elegant way to generate and validate one time passwords.

v1.0.3(3y ago)239MITPHPPHP ^8.0

Since Aug 5Pushed 3y ago1 watchersCompare

[ Source](https://github.com/prasanth-j/otpify)[ Packagist](https://packagist.org/packages/prasanth-j/otpify)[ Docs](https://github.com/prasanth-j/otpify)[ RSS](/packages/prasanth-j-otpify/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (5)Versions (6)Used By (0)

Laravel Otpify 🔑
================

[](#laravel-otpify-)

[![Build Status](https://camo.githubusercontent.com/7e83940173064b2b4e6a06f856203bc048e767ad969d170b97222735c06fbf79/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f70726173616e74682d6a2f6f74706966792f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/prasanth-j/otpify/build-status/master)[![Total Downloads](https://camo.githubusercontent.com/61b65334b1745f9968445b72ac23ef7fef74ce83bd8b7efeed7f72f6cc34e02e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f70726173616e74682d6a2f6f74706966792e737667)](https://packagist.org/packages/prasanth-j/otpify)[![Latest Version on Packagist](https://camo.githubusercontent.com/13df4db2cdc3936962dcf3081ed0a16fc57c6e1631c2354993fa1bcfbe786409/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f70726173616e74682d6a2f6f7470696679)](https://packagist.org/packages/prasanth-j/otpify)[![License: MIT](https://camo.githubusercontent.com/4cee3b0c35d9c4bb7d64c3ea0842daf10714208f10e24bddaaa48d319c845ed4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f70726173616e74682d6a2f6f7470696679)](https://opensource.org/licenses/MIT)

Introduction
------------

[](#introduction)

Otpify is a Laravel package that provides a simple and elegant way to generate and validate one time passwords.

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

[](#installation)

You can install the package via composer:

```
composer require prasanth-j/otpify
```

You can run the migrations with:

```
php artisan migrate
```

You can publish the config file with:

```
php artisan vendor:publish --tag="otpify-config"
```

This is the contents of the published config file:

```
return [
    /**
     * The length of token.
     */
    'digits'    => 6,

    /**
     * The expiry time of token in minutes.
     */
    'validity'  => 15
];
```

Optionally, you can publish the migrations using

```
php artisan vendor:publish --tag="otpify-migrations"
```

Usage
-----

[](#usage)

### 1. Generate OTP

[](#1-generate-otp)

```
use PrasanthJ\Otpify\Facades\Otpify;

Otpify::generate(string $identifier, int $userId, string $otpType, int $digits, int $validity);
```

- `$identifier`: The identity (email or mobile) that will be tied to the OTP.
- `$userId (optional | default = null)`: The user id from user table.
- `$otpType (optional | default = null)`: The category of the OTP, like login, verification, etc.
- `$digits (optional | default = 6)`: The amount of digits to be generated, should be 4 to 8.
- `$validity (optional | default = 15)`: The validity period of the OTP in minutes.

#### Example

[](#example)

```
use PrasanthJ\Otpify\Facades\Otpify;

$otp = Otpify::generate('john@example.com', 2, 'verification', 6, 10);
```

This will generate a six digit OTP that will be valid for 10 minutes and the success response will be:

```
{
  "status": "success",
  "token": "535923",
  "message": "OTP genetated successfully"
}

```

### 2. Validate OTP

[](#2-validate-otp)

```
use PrasanthJ\Otpify\Facades\Otpify;

Otpify::validate(string $identifier, string $token, string $otpType);
```

- `$identifier`: The identity (email or mobile) that will be tied to the OTP.
- `$token`: The token tied to the identity.
- `$otpType (optional | default = null)`: The category of the OTP, like login, verification, etc.

#### Example

[](#example-1)

```
use PrasanthJ\Otpify\Facades\Otpify;

$otp = Otpify::generate('john@example.com', '535923', 'verification');
```

#### Responses

[](#responses)

**On Success**

```
{
  "status": "success",
  "message": "OTP is valid"
}

```

**Does not exist**

```
{
  "status": "error",
  "message": "OTP does not exist"
}

```

**On Error**

```
{
  "status": "warning",
  "message": "OTP invalid"
}

```

**Expired**

```
{
  "status": "error",
  "message": "OTP Expired"
}

```

**Already Verified**

```
{
  "status": "info",
  "message": "OTP already verified"
}

```

### Delete verified tokens

[](#delete-verified-tokens)

You can delete verified tokens by running the following artisan command:

```
php artisan otpify:clean
```

You can also add this artisan command to `app/Console/Kernel.php` to automatically clean on scheduled

```
protected function schedule(Schedule $schedule)
{
    $schedule->command('otpify:clean')->daily();
}
```

Contribution
------------

[](#contribution)

If you find an issue with this package or you have any suggestions please help out.

License
-------

[](#license)

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

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

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

Every ~0 days

Total

4

Last Release

1370d ago

PHP version history (4 changes)v1.0.0PHP ^7.4

v1.0.1PHP &gt;=5.4.0

v1.0.2PHP &gt;=7.4.0

v1.0.3PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/85541084b54c4232d09cfd2b861299f5b505e5ce991193521758323489be6c64?d=identicon)[prasanthjayakumar](/maintainers/prasanthjayakumar)

---

Top Contributors

[![prasanth-j](https://avatars.githubusercontent.com/u/29867996?v=4)](https://github.com/prasanth-j "prasanth-j (7 commits)")

---

Tags

laravellaravel-otplaravel-packageone-time-passwordotp-verificationotpifylaravel otpotp-validationotpify

### Embed Badge

![Health badge](/badges/prasanth-j-otpify/health.svg)

```
[![Health](https://phpackages.com/badges/prasanth-j-otpify/health.svg)](https://phpackages.com/packages/prasanth-j-otpify)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M683](/packages/barryvdh-laravel-ide-helper)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.5k25.9M106](/packages/laravel-cashier)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M157](/packages/orchestra-canvas)[clickbar/laravel-magellan

This package provides functionality for working with the postgis extension in Laravel.

423715.4k1](/packages/clickbar-laravel-magellan)

PHPackages © 2026

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