PHPackages                             cloudmazing/filament-force-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. [Security](/categories/security)
4. /
5. cloudmazing/filament-force-2fa

ActiveLibrary[Security](/categories/security)

cloudmazing/filament-force-2fa
==============================

Force 2FA using a middleware

2.1(8mo ago)0647MITPHPPHP ^8.1CI failing

Since Dec 7Pushed 1mo ago3 watchersCompare

[ Source](https://github.com/WH-CloudMazing/filament-force-2fa)[ Packagist](https://packagist.org/packages/cloudmazing/filament-force-2fa)[ Docs](https://github.com/cloudmazing/filament-force-2fa)[ RSS](/packages/cloudmazing-filament-force-2fa/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (13)Versions (7)Used By (0)

Force 2FA using a middleware
============================

[](#force-2fa-using-a-middleware)

[![Latest Version on Packagist](https://camo.githubusercontent.com/8102a9a948ebb0940fe2470ae9b048477185d757ceadf2f00515539d59a4461a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636c6f75646d617a696e672f66696c616d656e742d666f7263652d3266612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/cloudmazing/filament-force-2fa)[![GitHub Tests Action Status](https://camo.githubusercontent.com/bc0b04e7a3c65c8d507467abfdc79fe795c18d412157030148097e22d1a416b1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f57482d436c6f75644d617a696e672f66696c616d656e742d666f7263652d3266612f72756e2d74657374732e796d6c3f6c6162656c3d7465737473)](https://github.com/cloudmazing/filament-force-2fa/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/7b225e30a7f9342983db1a2b195982f9f0e8579a93e153d928052d801f60b09a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f57482d436c6f75644d617a696e672f66696c616d656e742d666f7263652d3266612f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6c6162656c3d636f64652532307374796c65)](https://github.com/WH-CloudMazing/filament-force-2fa/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/bf0ae03c764ff10efebe03722751af12ef8ac1b1a0839c37aab1ce0716fa3834/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636c6f75646d617a696e672f66696c616d656e742d666f7263652d3266612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/cloudmazing/filament-force-2fa)

Usage
=====

[](#usage)

The package exposes a middleware that forces the user to have 2FA enabled. If the user don't, they are redirected to the filament 2FA settings page (based on [webbingbrasil/filament-2fa](https://github.com/webbingbrasil/filament-2fa)).

You can add the middleware to a middleware group (such as filament's `auth` group in `config/filament.php` which will *always* affect logged-in users).

```
    /*
    |--------------------------------------------------------------------------
    | Middleware
    |--------------------------------------------------------------------------
    |
    | You may customise the middleware stack that Filament uses to handle
    | requests.
    |
    */

    'middleware' => [
        'auth' => [
            // ...
            \CloudMazing\FilamentForce2FA\Http\Middleware\Require2FA::class,
        ],
        'base' => [
            //...
        ],
    ],
```

Or you can use the middleware on individual endpoints by registering in the Kernel `App\Http\Kernel`:

```
    protected $routeMiddleware = [
        //...
        '2fa' => \CloudMazing\FilamentForce2FA\Http\Middleware\Require2FA::class,
    ];
```

Then when declaring routes:

```
Route::middleware('2fa')->get('/hello');
```

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

[](#installation)

You can install the package via composer:

```
composer require cloudmazing/filament-force-2fa
```

You can publish and run the migrations with:

```
php artisan vendor:publish --tag="filament-force-2fa-migrations"
php artisan migrate
```

Changelog
---------

[](#changelog)

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

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

[](#contributing)

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

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

[](#security-vulnerabilities)

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

Credits
-------

[](#credits)

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

License
-------

[](#license)

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

###  Health Score

45

—

FairBetter than 92% of packages

Maintenance81

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~328 days

Total

4

Last Release

262d ago

Major Versions

1.1 → 2.02024-05-20

### Community

Maintainers

![](https://www.gravatar.com/avatar/389531181f1dc039ce07245fb5fac7c9a052e96c133471ebe5c68194bf1f1830?d=identicon)[jwiegant](/maintainers/jwiegant)

---

Top Contributors

[![SychO9](https://avatars.githubusercontent.com/u/20267363?v=4)](https://github.com/SychO9 "SychO9 (10 commits)")[![jwiegant](https://avatars.githubusercontent.com/u/3584267?v=4)](https://github.com/jwiegant "jwiegant (6 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")[![jaggy](https://avatars.githubusercontent.com/u/1993075?v=4)](https://github.com/jaggy "jaggy (3 commits)")[![luceos](https://avatars.githubusercontent.com/u/504687?v=4)](https://github.com/luceos "luceos (3 commits)")

---

Tags

laravelcloudmazingfilament-force-2fa

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/cloudmazing-filament-force-2fa/health.svg)

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

###  Alternatives

[spatie/laravel-ciphersweet

Use ciphersweet in your Laravel project

416718.4k1](/packages/spatie-laravel-ciphersweet)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)

PHPackages © 2026

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