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

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

hamidmp/otp-manager
===================

OTPManager - OTP service for laravel

v1.1.2(4y ago)180MITPHPPHP &gt;=7.0

Since Mar 31Pushed 4y ago1 watchersCompare

[ Source](https://github.com/HamidMp/otp-manager)[ Packagist](https://packagist.org/packages/hamidmp/otp-manager)[ RSS](/packages/hamidmp-otp-manager/feed)WikiDiscussions main Synced today

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

OTP Manager (Laravel library)
-----------------------------

[](#otp-manager-laravel-library)

**OTP Manager** is a Laravel OTP library.
Verification user by One Time Password via SMS or email or anything else. You can choose various type of authentication method like cookie or request-header.

#### some features:

[](#some-features)

You can create **OTP link** and sending through **email** or create **OTP PIN code** and sending through **SMS** or notification etc. You can choose between **cookie** or **request-header** (localstorage or fix variable) in client-side.
*Note: In this tools you can using verification even without user.*

One Time Password
-----------------

[](#one-time-password)

A one-time password (OTP), also known as one-time PIN or dynamic password, is a password that is valid for only one login session or transaction, on a computer system or other digital device.

Token types:
------------

[](#token-types)

bearer, cookie, session or request

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

[](#installation)

1. Install requirements:

    *Require with [Composer](https://getcomposer.org/)*

    ```
    composer require hamidmp/otp-manager
    ```
2. Publishing files:

    ```
     php artisan vendor:publish --tag otpmanager
    ```

    It will copy the migration files (two files) and config file and middleware file.
3. Change the config values to your prefer configs:

    1. you have to declare the password (PIN) sender class in config file which the password sender class must be implemented from `OTPMessageInterface`:

        ```
        //config/otpmanage.php

        return [

        //...
        'message_provider'=>\App\Srvice\SMSProvider::class,
        //...

        ];
        ```
    2. you have to declare the authenticable class for `user_model`:

        ```
        //config/otpmanage.php

        return [

        //...
        'user_model'=>App\Models\User::class,
        //...

        ];
        ```
4. Config the database connection (you have done before)
5. Cache the configs:

    ```
    php artisan config:cache
    ```
6. Migrate the migrations

    ```
    php artisan migrate
    ```

    It will create new taable 'otpassword' for storing OTP PINs and adding two fields in `user_model` table (step 3.2) for user contact value (like mobile) and OTP-token.

Usage
-----

[](#usage)

- Taking user contact and generating new PIN and sending it

    ```
    // App/Http/Controllers/SiteController

    OTPManager::generateAndSendNewOTP($request);
    ```
- Checking user PIN code

    ```
    // App/Http/Controllers/SiteController

    $result = OTPManager::checkUserOTPAndVerification($request, $request->code);
    ```
- You can use the OTPManager without user and then after verification assign a user to that verified request (then you can using 'auth:otpmanager' middleware for identity the user)

    ```
    // App/Http/Controllers/SiteController

    $result = OTPManager::checkUserOTPAndVerification($request, $request->code);

    //just after verification
    if($result!==false){
        $user=User::find(1);
        OTPManager::assignUserTo($result,$user);
    }
    ```
- Using *auth* middleware for ensuring that user authenticated

    ```
    //routes/web.php

    Route::middleware('auth:otpmanager')
        ->group(function () {
            //...

            Route::get('/user',function (){
                $user = \request()->user();
                //or
                $user = \Illuminate\Support\Facades\Auth::user();
            });

        });
    ```
- Using *OTPManagerMiddleware* middleware for checking verification (first step or complete)

    ```
    //routes/web.php

    Route::middleware([\App\Http\Middleware\OTPManagerMiddleware::class])
        ->group(function () {
            //OTP verification has passed completely

        });

    Route::middleware('\App\Http\Middleware\OTPManagerMiddleware:false')
        ->group(function () {
            //OTP verification has passed its fist step at least (sending PIN code and having Token)

        });
    ```

License
-------

[](#license)

The **otp-manager** library is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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 ~7 days

Total

10

Last Release

1798d ago

### Community

Maintainers

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

---

Top Contributors

[![HamidMp](https://avatars.githubusercontent.com/u/6995764?v=4)](https://github.com/HamidMp "HamidMp (17 commits)")

---

Tags

authenticationlaravelotpotp-verification

### Embed Badge

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

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

###  Alternatives

[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[laragear/two-factor

On-premises 2FA Authentication for out-of-the-box.

339785.3k8](/packages/laragear-two-factor)[laragear/webauthn

Authenticate users with Passkeys: fingerprints, patterns and biometric data.

403480.4k8](/packages/laragear-webauthn)

PHPackages © 2026

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