PHPackages                             wiebenieuwenhuis/laravel2fa - 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. wiebenieuwenhuis/laravel2fa

ActiveLibrary

wiebenieuwenhuis/laravel2fa
===========================

2.3.4(2y ago)05.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/laravel2fa)[ RSS](/packages/wiebenieuwenhuis-laravel2fa/feed)WikiDiscussions master Synced 1mo 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

35

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity75

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

799d 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://www.gravatar.com/avatar/c128a37b027f47582249bbb0a5b2a1373d2b0b5cbe28bef7ba7a3811db0ec279?d=identicon)[sweebee](/maintainers/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-laravel2fa/health.svg)

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

###  Alternatives

[laravel/fortify

Backend controllers and scaffolding for Laravel authentication.

1.7k41.4M245](/packages/laravel-fortify)[statamic/cms

The Statamic CMS Core Package

4.8k3.2M720](/packages/statamic-cms)[craftcms/cms

Craft CMS

3.6k3.6M2.6k](/packages/craftcms-cms)[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

22.8k69.3k](/packages/grumpydictator-firefly-iii)[jeffgreco13/filament-breezy

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

1.0k1.7M41](/packages/jeffgreco13-filament-breezy)[danog/madelineproto

Async PHP client API for the telegram MTProto protocol.

3.4k855.0k18](/packages/danog-madelineproto)

PHPackages © 2026

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