PHPackages                             asubodh/filament-two-factor-auth - 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. [Security](/categories/security)
4. /
5. asubodh/filament-two-factor-auth

ActiveLibrary[Security](/categories/security)

asubodh/filament-two-factor-auth
================================

A production-ready Two-Factor Authentication plugin for Filament admin panels with TOTP, QR codes, recovery codes, and middleware protection.

v1.0.0(1mo ago)42MITPHPPHP ^8.2

Since May 9Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/asubodh/filament-two-factor-auth)[ Packagist](https://packagist.org/packages/asubodh/filament-two-factor-auth)[ Docs](https://github.com/asubodh/filament-two-factor-auth)[ RSS](/packages/asubodh-filament-two-factor-auth/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (10)Versions (2)Used By (0)

Filament Multi-Factor Auth (MFA)
================================

[](#filament-multi-factor-auth-mfa)

[![Latest Version on Packagist](https://camo.githubusercontent.com/20ee0017f62edbadd1c4688bd9193824cd962dbe6af29a298b47d6956411dcb2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f617375626f64682f66696c616d656e742d74776f2d666163746f722d617574682e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/asubodh/filament-two-factor-auth)[![License](https://camo.githubusercontent.com/6409e4c37e14f460114e76be68a8ab4816ba72b89f848924ebaadd284e9879ef/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f617375626f64682f66696c616d656e742d74776f2d666163746f722d617574682e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/asubodh/filament-two-factor-auth)

A robust, production-ready **Multi-Factor Authentication (MFA)** plugin designed specifically for [Filament](https://filamentphp.com) v5 admin panels.

Created by **Subodh Aryal (@asubodh)**, this package provides a seamless and highly secure integration of TOTP-based authentication compatible with **Google Authenticator**, **Authy**, **Microsoft Authenticator**, and any standard TOTP application.

---

✨ Features
----------

[](#-features)

- 🔐 **TOTP Authentication** — Time-based One-Time Password (RFC 6238).
- 📱 **QR Code Setup** — Scan-to-configure with any authenticator app.
- 🔑 **Recovery Codes** — One-time backup codes with hashed database storage.
- 🛡️ **Login Challenge** — Native OTP verification page displayed securely after standard login.
- 🚨 **Enforce 2FA** — Option to force all users to set up 2FA before they can access the panel.
- 🍪 **Trusted Devices** — Optional "remember this device" functionality.
- ⚡ **Rate Limiting** — Built-in brute-force protection on OTP attempts.
- 🔒 **Encrypted Secrets** — TOTP secrets are encrypted at rest using Laravel Crypt.
- 📡 **Event System** — Listen to events for enable, disable, verify, and failed attempts.
- 🎨 **Native Filament UI** — Clean, dark-mode compatible settings and challenge pages that blend perfectly with your panel.

---

📋 Requirements
--------------

[](#-requirements)

- PHP 8.2+
- Laravel 11.0+
- Filament v5.0+

---

🚀 Installation &amp; Setup
--------------------------

[](#-installation--setup)

### 1. Install the Package

[](#1-install-the-package)

Pull the package into your project using Composer:

```
composer require asubodh/filament-two-factor-auth
```

### 2. Publish and Run Migrations

[](#2-publish-and-run-migrations)

Publish the necessary database migrations and run them. This will add the required columns to your `users` table and create a new `two_factor_recovery_codes` table.

```
php artisan vendor:publish --tag="two-factor-auth-migrations"
php artisan migrate
```

### 3. Publish Configuration (Optional)

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

You can publish the configuration file to customize the default behavior:

```
php artisan vendor:publish --tag="two-factor-auth-config"
```

### 4. Prepare Your User Model

[](#4-prepare-your-user-model)

Update your `User` model to implement the `TwoFactorAuthenticatable` interface and use the `HasTwoFactorAuth` trait.

```
