PHPackages                             lunarphp/filament3-2fa - 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. lunarphp/filament3-2fa

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

lunarphp/filament3-2fa
======================

Filament Two Factor Authentication: Google 2FA + Passkey Authentication

3.0.8(9mo ago)035.9k—8.7%1MITPHPPHP ^8.3

Since Aug 23Pushed 5mo agoCompare

[ Source](https://github.com/lunarphp/filament3-2fa)[ Packagist](https://packagist.org/packages/lunarphp/filament3-2fa)[ Docs](https://github.com/stephenjude/filament-two-factor-authentication)[ GitHub Sponsors](https://github.com/stephenjude)[ RSS](/packages/lunarphp-filament3-2fa/feed)WikiDiscussions 2.x Synced yesterday

READMEChangelog (1)Dependencies (12)Versions (48)Used By (1)

[![Screenshot](https://raw.githubusercontent.com/stephenjude/filament-two-factor-authentication/main/art/banner.jpg)](https://raw.githubusercontent.com/stephenjude/filament-two-factor-authentication/main/art/banner.jpg)

Filament Two Factor Authentication (2FA)
========================================

[](#filament-two-factor-authentication-2fa)

[![Latest Version on Packagist](https://camo.githubusercontent.com/5f917786e26828ffb14d9284b03b5c79f9608df39f3efe517a36f97eecca0879/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7374657068656e6a7564652f66696c616d656e742d74776f2d666163746f722d61757468656e7469636174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/stephenjude/filament-two-factor-authentication)[![GitHub Tests Action Status](https://camo.githubusercontent.com/269411e75dff7f8c2becc5c59b50014cc06f049ffa3acf4ab14dc00963b90a6d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7374657068656e6a7564652f66696c616d656e742d74776f2d666163746f722d61757468656e7469636174696f6e2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/stephenjude/filament-two-factor-authentication/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/857c616996b581ae1a10e0bf2f234ae665877cbfc49f54855e6e453fac4a8b6c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7374657068656e6a7564652f66696c616d656e742d74776f2d666163746f722d61757468656e7469636174696f6e2f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/stephenjude/filament-two-factor-authentication/actions?query=workflow%3A%22Fix+PHP+code+styling%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/ec300517263544dcb34d20e5767041430d8cd53e20263c222a6f8b28ec564921/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7374657068656e6a7564652f66696c616d656e742d74776f2d666163746f722d61757468656e7469636174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/stephenjude/filament-two-factor-authentication)

Add two-factor authentication to new and existing Filament applications.

Learn More
----------

[](#learn-more)

[Filament Two-Factor Authentication Demo](https://www.youtube.com/watch?v=zLqKFsAmEaQ) — Filament Daily

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

[](#installation)

Below, you'll find documentation on installing this plugin. If you have any questions, find a bug, need support, or have a feature request, please don't hesitate to reach out to me at .

You can install the package via composer:

```
composer require stephenjude/filament-two-factor-authentication
```

Add the `TwoFactorAuthenticatable` trait to your application's authentication model and implement the `HasPasskeys` trait:

```
namespace App\Models;

use Spatie\LaravelPasskeys\Models\Concerns\HasPasskeys;
use Stephenjude\FilamentTwoFactorAuthentication\TwoFactorAuthenticatable;

//...

class User extends Authenticatable implements FilamentUser, HasPasskeys
{
    use TwoFactorAuthenticatable;

    //...
```

> ⚠️ Passkey implementation is using the [spatie/laravel-passkeys](https://github.com/spatie/laravel-passkeys) package under the hood.

Install the plugin migration using:

```
php artisan filament-two-factor-authentication:install
```

Optionally, you can publish the views using

```
php artisan vendor:publish --tag="filament-two-factor-authentication-views"
```

Plugin Configuration
--------------------

[](#plugin-configuration)

Add two-factor authentication plugin to a panel by instantiating the plugin class and passing it to the plugin() method of the configuration:

```
...
use Stephenjude\FilamentTwoFactorAuthentication\TwoFactorAuthenticationPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            TwoFactorAuthenticationPlugin::make()
                    ->enableTwoFactorAuthentication() // Enable Google 2FA
                    ->enablePasskeyAuthentication() // Enable Passkey
                    ->addTwoFactorMenuItem() // Add 2FA menu item
                    ->forceTwoFactorSetup() // Force 2FA setup
        ])
}
...
```

### Advanced Configurations

[](#advanced-configurations)

```
use Stephenjude\FilamentTwoFactorAuthentication\TwoFactorAuthenticationPlugin;
use Stephenjude\FilamentTwoFactorAuthentication\Middleware\ForceTwoFactorSetup;
use Stephenjude\FilamentTwoFactorAuthentication\Middleware\TwoFactorChallenge;

TwoFactorAuthenticationPlugin::make()
        ->enableTwoFactorAuthentication(
            condition:  true, // Enable Google 2FA
            challengeMiddleware:  TwoFactorChallenge::class, // Middleware to challenge user with 2FA
        )
        ->enablePasskeyAuthentication(
            condition:  true, // Enable Passkey
        )
        ->forceTwoFactorSetup(
            condition:  true, // Force 2FA setup for all users
            requiresPassword:  true, // Require password during setup
            forceMiddleware:  ForceTwoFactorSetup::class, // Middleware to enforce 2FA
        )
        ->addTwoFactorMenuItem(
            condition:  true, // Show 2FA on the user menu item
            label:  '2FA', // Menu item label
            icon:  'heroicon-s-key', // Menu item icon
        )
])
```

### Custom Settings Page

[](#custom-settings-page)

If your application already has a user profile page, you can add a 2FA settings to your profile page view:

```

    @livewire(\Stephenjude\FilamentTwoFactorAuthentication\Livewire\TwoFactorAuthentication::class)

    @livewire(\Stephenjude\FilamentTwoFactorAuthentication\Livewire\PasskeyAuthentication::class)

```

Events
------

[](#events)

This package dispatches events which your application can subscribe to. You can listen to these events inside your EventServiceProvider class:

```
use Stephenjude\FilamentTwoFactorAuthentication\Events\{RecoveryCodeReplaced,RecoveryCodesGenerated,TwoFactorAuthenticationChallenged,TwoFactorAuthenticationConfirmed,TwoFactorAuthenticationDisabled,TwoFactorAuthenticationEnabled,TwoFactorAuthenticationFailed,ValidTwoFactorAuthenticationCodeProvided};

protected $listen = [
    TwoFactorAuthenticationChallenged::class => [
        // Dispatched when a user is required to enter 2FA code during login.
    ],
    TwoFactorAuthenticationFailed::class => [
        // Dispatched when a user provides incorrect 2FA code or recovery code during login.
    ],
    ValidTwoFactorAuthenticationCodeProvided::class => [
        // Dispatched when a user provides a valid 2FA code during login.
    ]
    TwoFactorAuthenticationConfirmed::class => [
        // Dispatched when a user confirms code during 2FA setup.
    ],
    TwoFactorAuthenticationEnabled::class => [
        // Dispatched when a user enables 2FA.
    ],
    TwoFactorAuthenticationDisabled::class => [
        // Dispatched when a user disables 2FA.
    ],
    RecoveryCodeReplaced::class => [
        // Dispatched after a user's recovery code is replaced.
    ],
    RecoveryCodesGenerated::class => [
        // Dispatched after a user's recovery codes are generated.
    ],
];
```

Screenshot
----------

[](#screenshot)

[![Screenshot](https://raw.githubusercontent.com/stephenjude/filament-two-factor-authentication/main/art/1.jpeg)](https://raw.githubusercontent.com/stephenjude/filament-two-factor-authentication/main/art/1.jpeg)

#### 2FA Authentication

[](#2fa-authentication)

[![Screenshot](https://raw.githubusercontent.com/stephenjude/filament-two-factor-authentication/main/art/2.jpeg)](https://raw.githubusercontent.com/stephenjude/filament-two-factor-authentication/main/art/2.jpeg)

#### 2FA Recovery

[](#2fa-recovery)

[![Screenshot](https://raw.githubusercontent.com/stephenjude/filament-two-factor-authentication/main/art/3.jpeg)](https://raw.githubusercontent.com/stephenjude/filament-two-factor-authentication/main/art/3.jpeg)

#### 2FA Disabled

[](#2fa-disabled)

[![Screenshot](https://raw.githubusercontent.com/stephenjude/filament-two-factor-authentication/main/art/5.png)](https://raw.githubusercontent.com/stephenjude/filament-two-factor-authentication/main/art/5.png)

#### 2FA Setup

[](#2fa-setup)

[![Screenshot](https://raw.githubusercontent.com/stephenjude/filament-two-factor-authentication/main/art/4.jpeg)](https://raw.githubusercontent.com/stephenjude/filament-two-factor-authentication/main/art/4.jpeg)

#### 2FA Enabled (Recovery Codes)

[](#2fa-enabled-recovery-codes)

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [stephenjude](https://github.com/stephenjude)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance66

Regular maintenance activity

Popularity30

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 76.7% 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 ~11 days

Recently: every ~34 days

Total

48

Last Release

155d ago

Major Versions

0.0.27 → 1.0.02025-05-12

1.0.0 → 2.0.02025-05-19

2.0.7 → 3.0.02025-08-16

2.0.8 → 3.0.12025-08-16

PHP version history (2 changes)0.0.1PHP ^8.1

3.0.0PHP ^8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/112434999?v=4)[Lunar - Headless E-Commerce for Laravel](/maintainers/lunarphp)[@lunarphp](https://github.com/lunarphp)

---

Top Contributors

[![stephenjude](https://avatars.githubusercontent.com/u/31182887?v=4)](https://github.com/stephenjude "stephenjude (158 commits)")[![webard](https://avatars.githubusercontent.com/u/855788?v=4)](https://github.com/webard "webard (18 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (6 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (4 commits)")[![Abdulmajeed-Jamaan](https://avatars.githubusercontent.com/u/41128358?v=4)](https://github.com/Abdulmajeed-Jamaan "Abdulmajeed-Jamaan (3 commits)")[![elishaukpong](https://avatars.githubusercontent.com/u/31503827?v=4)](https://github.com/elishaukpong "elishaukpong (3 commits)")[![alecritson](https://avatars.githubusercontent.com/u/1488016?v=4)](https://github.com/alecritson "alecritson (2 commits)")[![kateengland-moore](https://avatars.githubusercontent.com/u/126901020?v=4)](https://github.com/kateengland-moore "kateengland-moore (2 commits)")[![glennjacobs](https://avatars.githubusercontent.com/u/647407?v=4)](https://github.com/glennjacobs "glennjacobs (1 commits)")[![GlitterCakes](https://avatars.githubusercontent.com/u/5402396?v=4)](https://github.com/GlitterCakes "GlitterCakes (1 commits)")[![gustavocaiano](https://avatars.githubusercontent.com/u/104129313?v=4)](https://github.com/gustavocaiano "gustavocaiano (1 commits)")[![hurycz](https://avatars.githubusercontent.com/u/8737590?v=4)](https://github.com/hurycz "hurycz (1 commits)")[![devOMAR-2](https://avatars.githubusercontent.com/u/93110311?v=4)](https://github.com/devOMAR-2 "devOMAR-2 (1 commits)")[![RChutchev](https://avatars.githubusercontent.com/u/11131666?v=4)](https://github.com/RChutchev "RChutchev (1 commits)")[![ashleyshenton](https://avatars.githubusercontent.com/u/26444425?v=4)](https://github.com/ashleyshenton "ashleyshenton (1 commits)")[![talha-abdullah-990](https://avatars.githubusercontent.com/u/44542495?v=4)](https://github.com/talha-abdullah-990 "talha-abdullah-990 (1 commits)")[![waleedGRT](https://avatars.githubusercontent.com/u/55159721?v=4)](https://github.com/waleedGRT "waleedGRT (1 commits)")[![brunovt074](https://avatars.githubusercontent.com/u/111722616?v=4)](https://github.com/brunovt074 "brunovt074 (1 commits)")

---

Tags

laravel2faTwo Factor Authenticationfilamentstephenjudepasskey authentication

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/lunarphp-filament3-2fa/health.svg)

```
[![Health](https://phpackages.com/badges/lunarphp-filament3-2fa/health.svg)](https://phpackages.com/packages/lunarphp-filament3-2fa)
```

###  Alternatives

[stephenjude/filament-two-factor-authentication

Filament Two Factor Authentication: Google 2FA + Passkey Authentication

84215.9k9](/packages/stephenjude-filament-two-factor-authentication)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[jeffgreco13/filament-breezy

A custom package for Filament with login flow, profile and teams support.

1.0k2.1M57](/packages/jeffgreco13-filament-breezy)[marcelweidum/filament-passkeys

Use passkeys in your filamentphp app

6649.5k1](/packages/marcelweidum-filament-passkeys)[stephenjude/filament-jetstream

A Laravel starter kit built with Filament inspired by Jetstream.

17760.2k3](/packages/stephenjude-filament-jetstream)[stephenjude/filament-feature-flags

Filament implementation of feature flags and segmentation with Laravel Pennant.

122177.8k1](/packages/stephenjude-filament-feature-flags)

PHPackages © 2026

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