PHPackages                             taha-moghaddam/filament-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. taha-moghaddam/filament-otp-login

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

taha-moghaddam/filament-otp-login
=================================

OTP Login for Filament v5 - Mobile/Phone login with OTP, no password, no session (mobile in URL)

v1.0.0(4mo ago)2557↑70%2[1 issues](https://github.com/taha-moghaddam/filament-otp-login/issues)MITPHPPHP ^8.2

Since Feb 1Pushed 4mo agoCompare

[ Source](https://github.com/taha-moghaddam/filament-otp-login)[ Packagist](https://packagist.org/packages/taha-moghaddam/filament-otp-login)[ Docs](https://github.com/taha-moghaddam/filament-otp-login)[ RSS](/packages/taha-moghaddam-filament-otp-login/feed)WikiDiscussions main Synced 3w ago

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

Filament OTP Login
==================

[](#filament-otp-login)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c2829323c80db1b45978910ad8d9f7110ff71b6d7a4fbde7aadd77512c6c99a8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746168612d6d6f6768616464616d2f66696c616d656e742d6f74702d6c6f67696e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/taha-moghaddam/filament-otp-login)[![Total Downloads](https://camo.githubusercontent.com/7e86df124a7bdf6787e33d0c46823cb6b661c296902786e028fb3741d2cb2c92/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746168612d6d6f6768616464616d2f66696c616d656e742d6f74702d6c6f67696e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/taha-moghaddam/filament-otp-login)

OTP (One-Time Password) login for **Filament v5**: mobile/phone number login with OTP code, no password, no session (mobile passed in URL). Users can “register” by logging in with OTP for the first time.

Features
--------

[](#features)

- **Mobile + OTP only** – No password, no email. User enters mobile → receives OTP → enters code on next page.
- **No session for pending state** – Mobile number is passed in the URL (e.g. `?mobile=...`) to the OTP verification page.
- **Configurable request block** – `request_block_seconds`: time (in seconds) before the same mobile can request another OTP.
- **Same OTP resend** – Up to N times (configurable, default 3) the same code is resent; after that a new OTP is generated.
- **Pluggable OTP delivery** – Implement `OtpSenderInterface` (SMS, email, log, etc.) and set it in config.
- **Filament 5** – Built for Filament v5 panels.

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 11 or 12
- Filament 4 or 5
- Livewire 3 or 4

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

[](#installation)

```
composer require taha-moghaddam/filament-otp-login
```

### 1. User model and table

[](#1-user-model-and-table)

Your user model (e.g. `App\Models\AdminUser`) must have at least:

- A **mobile column** (name configurable, default: `mobile`) – unique, stored as string or bigInteger.
- **OTP fields**: `otp_code` (nullable int), `otp_expires_at` (nullable timestamp), `otp_sent_count` (int, default 0), `mobile_verified_at` (nullable timestamp).

Example migration for `admin_users`:

```
Schema::create('admin_users', function (Blueprint $table) {
    $table->id();
    $table->string('name');
    $table->unsignedBigInteger('mobile')->unique();
    $table->timestamp('mobile_verified_at')->nullable();
    $table->unsignedSmallInteger('otp_code')->nullable();
    $table->timestamp('otp_expires_at')->nullable();
    $table->unsignedTinyInteger('otp_sent_count')->default(0);
    $table->rememberToken();
    $table->timestamps();
});
```

### 2. Publish and run migrations (OTP logs table)

[](#2-publish-and-run-migrations-otp-logs-table)

```
php artisan vendor:publish --tag="filament-otp-login-migrations"
php artisan migrate
```

### 3. Publish config (optional)

[](#3-publish-config-optional)

```
php artisan vendor:publish --tag="filament-otp-login-config"
```

Then edit `config/filament-otp-login.php`:

- **user\_model** – Your user model class (e.g. `App\Models\AdminUser`).
- **otp\_log.table** – Table name for OTP logs (default: `admin_otp_logs`).
- **otp\_log.user\_foreign\_key** – Foreign key to users (default: `admin_user_id`).
- **mobile\_column** – Column name for mobile number (default: `mobile`).
- **sender** – Class implementing `FilamentOtpLogin\Contracts\OtpSenderInterface` (default: `LogOtpSender` – logs to Laravel log).
- **otp\_length**, **otp\_expires\_seconds**, **request\_block\_seconds**, **same\_otp\_max\_sends** – Behaviour and limits.

### 4. Register the plugin on your panel

[](#4-register-the-plugin-on-your-panel)

In your Filament panel provider (e.g. `AdminPanelProvider`):

```
use FilamentOtpLogin\FilamentOtpLoginPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->id('admin')
        ->path('admin')
        ->authGuard('admin')  // use the guard that uses your user model
        ->plugins([
            FilamentOtpLoginPlugin::make(),
        ])
        // ... rest of panel config
        ;
}
```

Do **not** call `->login()` or `->registration()` on the panel; the plugin sets the login page and disables registration.

### 5. Auth guard (optional)

[](#5-auth-guard-optional)

Ensure `config/auth.php` has a guard that uses your user model, e.g.:

```
'guards' => [
    'admin' => [
        'driver' => 'session',
        'provider' => 'admin_users',
    ],
],
'providers' => [
    'admin_users' => [
        'driver' => 'eloquent',
        'model' => App\Models\AdminUser::class,
    ],
],
```

Configuration (env)
-------------------

[](#configuration-env)

KeyDescriptionDefault`FILAMENT_OTP_LOGIN_USER_MODEL`User model class`App\Models\AdminUser``FILAMENT_OTP_LOGIN_OTP_LOG_TABLE`OTP logs table name`admin_otp_logs``FILAMENT_OTP_LOGIN_USER_FOREIGN_KEY`FK column in OTP logs`admin_user_id``FILAMENT_OTP_LOGIN_MOBILE_COLUMN`Mobile column on user`mobile``FILAMENT_OTP_LOGIN_SENDER`OTP sender class`FilamentOtpLogin\Services\LogOtpSender``FILAMENT_OTP_LOGIN_OTP_LENGTH`OTP code length`6``FILAMENT_OTP_LOGIN_OTP_EXPIRES_SECONDS`OTP validity (seconds)`120``FILAMENT_OTP_LOGIN_REQUEST_BLOCK_SECONDS`Block before next request (seconds)`60``FILAMENT_OTP_LOGIN_SAME_OTP_MAX_SENDS`Same code resend limit`3`Custom OTP sender
-----------------

[](#custom-otp-sender)

Implement `FilamentOtpLogin\Contracts\OtpSenderInterface`:

```
use FilamentOtpLogin\Contracts\OtpSenderInterface;
use Illuminate\Contracts\Auth\Authenticatable;

class MySmsOtpSender implements OtpSenderInterface
{
    public function send(Authenticatable $user, string $code): void
    {
        $mobile = $user->mobile; // or $user->{config('filament-otp-login.mobile_column')}
        // Send SMS to $mobile with $code
    }
}
```

Register it in config:

```
'sender' => \App\Services\MySmsOtpSender::class,
```

Translations
------------

[](#translations)

Publish and edit translations:

```
php artisan vendor:publish --tag="filament-otp-login-translations"
```

Keys are under `resources/lang/vendor/filament-otp-login/` (e.g. `en/filament-otp-login.php`). English and Persian (fa) are included in the package.

Flow
----

[](#flow)

1. User opens panel login → sees **mobile** field only.
2. Submits mobile → rate limit checked (`request_block_seconds`), user found or created, OTP generated or same code resent (up to `same_otp_max_sends`), OTP sent via `OtpSenderInterface`, redirect to **phone-verification-prompt?mobile=...**.
3. User enters OTP on verification page → code validated, user logged in, redirect to panel.

No session is used for the “pending” user; the mobile in the URL identifies the user on the OTP page.

Security
--------

[](#security)

- Use HTTPS in production.
- Rate limiting is applied per mobile (`request_block_seconds`).
- OTP logs table can be pruned (e.g. scheduled job) to avoid bloat.

Changelog
---------

[](#changelog)

See [Releases](https://github.com/taha-moghaddam/filament-otp-login/releases).

License
-------

[](#license)

MIT. See [LICENSE.md](LICENSE.md).

Publish to Packagist and GitHub
-------------------------------

[](#publish-to-packagist-and-github)

1. Create a new repository on GitHub (e.g. `taha-moghaddam/filament-otp-login`).
2. Push the `filament-otp-login` folder to GitHub.
3. Register the package on [Packagist](https://packagist.org) and link your GitHub repo.
4. Submit to the [Filament plugin directory](https://filamentphp.com/plugins) so it appears on the Filament site.

Filament
--------

[](#filament)

This plugin is built for [Filament](https://filamentphp.com) v5.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance65

Regular maintenance activity

Popularity22

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

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

Unknown

Total

1

Last Release

146d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b1fcee05742abb18afc41177560637f6c24f5a04603cc2f2134b45d1b103041c?d=identicon)[taha-moghaddam](/maintainers/taha-moghaddam)

---

Top Contributors

[![taha-moghaddam](https://avatars.githubusercontent.com/u/3314387?v=4)](https://github.com/taha-moghaddam "taha-moghaddam (2 commits)")

---

Tags

laravelotpAuthenticationphonemobileloginfilamentfilament-5

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/taha-moghaddam-filament-otp-login/health.svg)

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

###  Alternatives

[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k3.5M118](/packages/bezhansalleh-filament-shield)[tallstackui/tallstackui

TallStackUI is a powerful suite of Blade components that elevate your workflow of Livewire applications.

721160.4k12](/packages/tallstackui-tallstackui)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3913.7k](/packages/rawilk-profile-filament-plugin)[auth0/login

Auth0 Laravel SDK. Straight-forward and tested methods for implementing authentication, and accessing Auth0's Management API endpoints.

2745.2M3](/packages/auth0-login)[andrewdwallo/filament-companies

A comprehensive Laravel authentication and authorization system designed for Filament, focusing on multi-tenant company management.

35254.9k2](/packages/andrewdwallo-filament-companies)

PHPackages © 2026

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