PHPackages                             stephenjude/filament-two-factor-authentication - 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. stephenjude/filament-two-factor-authentication

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

stephenjude/filament-two-factor-authentication
==============================================

Filament Two Factor Authentication: Google 2FA + Passkey Authentication

4.1.1(1mo ago)81158.7k—7.2%34[1 issues](https://github.com/stephenjude/filament-two-factor-authentication/issues)[1 PRs](https://github.com/stephenjude/filament-two-factor-authentication/pulls)3MITPHPPHP ^8.3

Since Aug 23Pushed 1mo ago2 watchersCompare

[ Source](https://github.com/stephenjude/filament-two-factor-authentication)[ Packagist](https://packagist.org/packages/stephenjude/filament-two-factor-authentication)[ Docs](https://github.com/stephenjude/filament-two-factor-authentication)[ GitHub Sponsors](https://github.com/stephenjude)[ RSS](/packages/stephenjude-filament-two-factor-authentication/feed)WikiDiscussions 4.x Synced 1mo ago

READMEChangelog (10)Dependencies (24)Versions (59)Used By (3)

[![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

63

—

FairBetter than 99% of packages

Maintenance90

Actively maintained with recent releases

Popularity50

Moderate usage in the ecosystem

Community31

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 70.5% 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 ~10 days

Total

54

Last Release

56d ago

Major Versions

1.x-dev → 2.0.02025-05-19

2.0.7 → 3.0.02025-08-16

2.0.8 → 3.0.12025-08-16

2.x-dev → 4.0.02026-02-09

3.x-dev → 4.1.02026-03-23

PHP version history (2 changes)0.0.1PHP ^8.1

3.0.0PHP ^8.3

### Community

Maintainers

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

---

Top Contributors

[![stephenjude](https://avatars.githubusercontent.com/u/31182887?v=4)](https://github.com/stephenjude "stephenjude (217 commits)")[![broqit](https://avatars.githubusercontent.com/u/27624002?v=4)](https://github.com/broqit "broqit (24 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] (15 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (8 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)")[![yhyasyrian](https://avatars.githubusercontent.com/u/77106078?v=4)](https://github.com/yhyasyrian "yhyasyrian (2 commits)")[![andresilvagomez](https://avatars.githubusercontent.com/u/2415015?v=4)](https://github.com/andresilvagomez "andresilvagomez (2 commits)")[![kateengland-moore](https://avatars.githubusercontent.com/u/126901020?v=4)](https://github.com/kateengland-moore "kateengland-moore (2 commits)")[![engbz](https://avatars.githubusercontent.com/u/228270267?v=4)](https://github.com/engbz "engbz (1 commits)")[![devOMAR-2](https://avatars.githubusercontent.com/u/93110311?v=4)](https://github.com/devOMAR-2 "devOMAR-2 (1 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)")[![alecritson](https://avatars.githubusercontent.com/u/1488016?v=4)](https://github.com/alecritson "alecritson (1 commits)")[![Mapexss](https://avatars.githubusercontent.com/u/56773740?v=4)](https://github.com/Mapexss "Mapexss (1 commits)")[![RChutchev](https://avatars.githubusercontent.com/u/11131666?v=4)](https://github.com/RChutchev "RChutchev (1 commits)")[![brunovt074](https://avatars.githubusercontent.com/u/111722616?v=4)](https://github.com/brunovt074 "brunovt074 (1 commits)")

---

Tags

2fafilamentphplaravelphptwo-factor-authenticationlaravel2faTwo Factor Authenticationfilamentstephenjudepasskey authentication

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/stephenjude-filament-two-factor-authentication/health.svg)

```
[![Health](https://phpackages.com/badges/stephenjude-filament-two-factor-authentication/health.svg)](https://phpackages.com/packages/stephenjude-filament-two-factor-authentication)
```

###  Alternatives

[jeffgreco13/filament-breezy

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

1.0k1.7M41](/packages/jeffgreco13-filament-breezy)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[webbingbrasil/filament-2fa

A 2FA plugin for filament.

4740.7k](/packages/webbingbrasil-filament-2fa)[marcelweidum/filament-passkeys

Use passkeys in your filamentphp app

5925.8k](/packages/marcelweidum-filament-passkeys)[stephenjude/filament-jetstream

A Laravel starter kit built with Filament inspired by Jetstream.

17554.3k2](/packages/stephenjude-filament-jetstream)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3911.9k](/packages/rawilk-profile-filament-plugin)

PHPackages © 2026

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