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

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

amedev/otp-login
================

OTP Login module for Laravel

1.0.8(9mo ago)02MITPHPPHP ^8.0

Since Aug 1Pushed 9mo agoCompare

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

READMEChangelogDependencies (2)Versions (10)Used By (0)

OtpLogin
========

[](#otplogin)

**OtpLogin** is a Laravel package for OTP-based authentication, supporting multiple login handlers and SMS drivers, making it highly flexible and customizable.

---

📦 Installation
--------------

[](#-installation)

Install the package via Composer:

```
composer require amedev/otp-login
```

Publish package assets:

```
php artisan vendor:publish --tag=otp-login-config
php artisan vendor:publish --tag=otp-login-migrations
php artisan vendor:publish --tag=otp-login-models
php artisan vendor:publish --tag=otp-login-translations
```

Run migrations:

```
php artisan migrate
```

---

⚙️ Configuration
----------------

[](#️-configuration)

```
return [

    /*
    |--------------------------------------------------------------------------
    | Login Handler Configuration
    |--------------------------------------------------------------------------
    | Determines which login handler is active.
    | Supported options:
    |  - 'jwt'     : Uses JWT for authentication.
    |  - 'sanctum' : Uses Laravel Sanctum.
    |  - 'session' : Uses standard session-based login.
    | Override default with env variable `OTP_LOGIN_HANDLER`.
    */
    'handler' => [
        'key' => env('OTP_LOGIN_HANDLER', 'jwt'),
        'map' => [
            'jwt' => \OtpLogin\Handlers\JwtLoginHandler::class,
            'sanctum' => \OtpLogin\Handlers\SanctumLoginHandler::class,
            'session' => \OtpLogin\Handlers\SessionLoginHandler::class,
        ]
    ],

    /*
    |--------------------------------------------------------------------------
    | SMS Driver Configuration
    |--------------------------------------------------------------------------
    | Defines which SMS gateway driver to use for sending OTP codes.
    | Switch drivers with `OTP_SMS_DRIVER` environment variable.
    */
    'driver' => env('OTP_SMS_DRIVER', 'modirpayamak'),

    'drivers' => [
        'modirpayamak' => [
            'class' => \OtpLogin\Services\ModirPayamakSmsSender::class,
            'key' => env('SMS_PATTERN_CODE'),      // ModirPayamak API pattern code
            'sender' => env('SMS_SENDER', '10004346'), // Default sender number
            'username' => env('SMS_USERNAME'),
            'password' => env('SMS_PASSWORD'),
        ],
        'kavenegar' => [
            'class' => \OtpLogin\Services\KavenegarSmsSender::class,
        ],
    ],

    /*
    |--------------------------------------------------------------------------
    | OTP Code Lifetime
    |--------------------------------------------------------------------------
    | Duration in seconds for which the OTP code remains valid.
    | Default is 120 seconds (2 minutes).
    */
    'code_lifetime' => 120,

    /*
    |--------------------------------------------------------------------------
    | Model Bindings
    |--------------------------------------------------------------------------
    | Allows overriding the default OTP model.
    | Useful if you want to extend or customize the OTP code model.
    */
    'models' => [
        'otp' => \OtpLogin\Models\OtpCode::class,
    ],

];
```

---

🧪 API Usage
-----------

[](#-api-usage)

### Send OTP

[](#send-otp)

```
POST /api/otp/send
Content-Type: application/json

{
  "phone": "09123456789",
  "country": "+98"
}
```

Response:

```
{
  "success": true,
  "status": 200,
  "message": "کد تأیید ارسال شد.",
  "data": ""
}
```

---

### Verify OTP

[](#verify-otp)

```
POST /api/otp/verify
Content-Type: application/json

{
  "phone": "09123456789",
  "code": "1234"
}
```

Response:

```
{
  "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
  "token_type": "bearer",
  "expires_in": 3600
}
```

---

🌐 Localization
--------------

[](#-localization)

Language files are published to:

```
resources/lang/vendor/otp-login

```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance61

Regular maintenance activity

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

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

9

Last Release

278d ago

### Community

Maintainers

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

---

Top Contributors

[![aliNoori](https://avatars.githubusercontent.com/u/23056374?v=4)](https://github.com/aliNoori "aliNoori (37 commits)")

### Embed Badge

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

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

###  Alternatives

[hasinhayder/tyro

Tyro - The ultimate Authentication, Authorization, and Role &amp; Privilege Management solution for Laravel 12 &amp; 13

6712.1k2](/packages/hasinhayder-tyro)[ikechukwukalu/requirepin

A laravel package for pin confirmation and validation before processing requests to a specified route

24910.5k1](/packages/ikechukwukalu-requirepin)[mohamedgaber-intake40/sanctum-refresh-token

add refresh token feature to laravel sanctum official package

4573.9k](/packages/mohamedgaber-intake40-sanctum-refresh-token)[rickycezar/laravel-jwt-impersonate

Laravel Impersonate is a plugin that allows to you to authenticate as your users.

24117.6k](/packages/rickycezar-laravel-jwt-impersonate)[sametsahindogan/laravel-jwtredis

This package allows JWT-authenticated users to be stored and management in Redis with their roles, permissions, statuses and anything you want.

1221.9k](/packages/sametsahindogan-laravel-jwtredis)[devtical/filament-sanctum

Laravel Sanctum integration for Filament 4

533.0k](/packages/devtical-filament-sanctum)

PHPackages © 2026

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