PHPackages                             wiebenieuwenhuis/laravel-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. wiebenieuwenhuis/laravel-2fa

Abandoned → [wiebenieuwenhuis/laravel2fa](/?search=wiebenieuwenhuis%2Flaravel2fa)Library[Authentication &amp; Authorization](/categories/authentication)

wiebenieuwenhuis/laravel-2fa
============================

2.3.4(2y ago)02.2k[1 issues](https://github.com/sweebee/Laravel2fa/issues)PHPPHP ^7.3 || ^8.0

Since Apr 5Pushed 2y ago1 watchersCompare

[ Source](https://github.com/sweebee/Laravel2fa)[ Packagist](https://packagist.org/packages/wiebenieuwenhuis/laravel-2fa)[ RSS](/packages/wiebenieuwenhuis-laravel-2fa/feed)WikiDiscussions master Synced 3d ago

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

Laravel 2fa
===========

[](#laravel-2fa)

### Installation:

[](#installation)

```
composer require wiebenieuwenhuis/laravel2fa
php artisan vendor:publish --provider="Wiebenieuwenhuis\Laravel2fa\Laravel2faServiceProvider"
php artisan migrate

```

Add the middleware to the routeMiddlewares in the Kernel:

```
protected $routeMiddleware = [
    ...
    '2fa' => \Wiebenieuwenhuis\Laravel2fa\Middleware::class,
]

```

Make sure you add the `2fa` middleware to your routes. and have set the right variables in the `config/2fa.php` file.

### enable 2fa

[](#enable-2fa)

By route:

```
/2fa/setup // route("2fa::setup")

```

### disable 2fa

[](#disable-2fa)

By route:

```
/2fa/disable // route("2fa::disable")

```

By API:

```
\Wiebenieuwenhuis\Laravel2fa\Laravel2fa::disable()

```

Custom views
------------

[](#custom-views)

This package has its own views, these are published in your resource folder `resources/views/vendor/2fa`. You can modify these to your needs.

Advanced
--------

[](#advanced)

Generate a secret for a user:

`Wiebenieuwenhuis\Laravel2fa\Laravel2fa::generateSecret()`

Generate a QR code for setup:

`Wiebenieuwenhuis\Laravel2fa\Laravel2fa::generateQrCode()`

Validate a code:

`Wiebenieuwenhuis\Laravel2fa\Laravel2fa::validate($code)`

To enable 2fa after setup you can enable it, make sure you've created it first by creating a secret or generating a QR code.

`Wiebenieuwenhuis\Laravel2fa\Laravel2fa::enable()`

Disable the 2fa:

`Wiebenieuwenhuis\Laravel2fa\Laravel2fa::disable()`

To check if the user has 2fa enabled:

`Wiebenieuwenhuis\Laravel2fa\Laravel2fa::enabled()`

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity76

Established project with proven stability

 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

Every ~66 days

Recently: every ~199 days

Total

28

Last Release

848d ago

Major Versions

1.1.1 → 2.1.02020-11-05

1.0.21 → 2.0.02020-11-05

PHP version history (3 changes)1.0.11PHP ^7.2

1.0.13PHP ^7.1

2.1.5PHP ^7.3 || ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/10496485?v=4)[sweebee](/maintainers/sweebee)[@sweebee](https://github.com/sweebee)

---

Top Contributors

[![sweebee](https://avatars.githubusercontent.com/u/10496485?v=4)](https://github.com/sweebee "sweebee (40 commits)")

### Embed Badge

![Health badge](/badges/wiebenieuwenhuis-laravel-2fa/health.svg)

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

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M3.0k](/packages/craftcms-cms)[statamic/cms

The Statamic CMS Core Package

4.8k3.6M952](/packages/statamic-cms)[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.

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

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

1.0k2.1M54](/packages/jeffgreco13-filament-breezy)[laravel/fortify

Backend controllers and scaffolding for Laravel authentication.

1.7k51.2M364](/packages/laravel-fortify)

PHPackages © 2026

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