PHPackages                             renderbit/backpack-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. renderbit/backpack-2fa

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

renderbit/backpack-2fa
======================

2FA integration for Laravel Backpack using Fortify

1.1.0(6mo ago)0828[1 issues](https://github.com/RenderbitTechnologies/Backpack-2FA/issues)MITBladePHP ^8.2

Since Oct 24Pushed 6mo agoCompare

[ Source](https://github.com/RenderbitTechnologies/Backpack-2FA)[ Packagist](https://packagist.org/packages/renderbit/backpack-2fa)[ Docs](https://github.com/renderbit/backpack-2fa)[ RSS](/packages/renderbit-backpack-2fa/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (4)Versions (4)Used By (0)

Backpack 2FA
============

[](#backpack-2fa)

**2FA integration for Laravel Backpack using Fortify**
Provides Google 2-Factor Authentication for Backpack admin users, including QR codes, recovery codes, and a custom challenge view.

Package Overview
----------------

[](#package-overview)

This package enables secure two-factor authentication for Laravel Backpack admin users. It integrates:

- Laravel Fortify for 2FA handling.
- PragmaRX Google2FA for QR code generation.
- Seamless Backpack admin middleware and guards.
- Recovery codes and 2FA setup flow.

Features
--------

[](#features)

- Enable/disable 2FA for Backpack admin users
- Generate QR codes for Google Authenticator
- Regenerate/download recovery codes
- Customizable views for 2FA challenge
- Works with Backpack v6+ and Laravel 10+
- Full package-based implementation (no app-level Fortify modifications required)
- Optional middleware `twofactor` to protect routes

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

[](#installation)

1. Require the package via Composer:

```
composer require renderbit/backpack-2fa
```

2. Publish configuration and views (optional):

```
php artisan vendor:publish --provider="Renderbit\Backpack2fa\Backpack2FAServiceProvider" --tag=config
php artisan vendor:publish --provider="Renderbit\Backpack2fa\Backpack2FAServiceProvider" --tag=views
```

3. Verify your backpack guard is set in `config/auth.php`:

```
'guards' => [
    'backpack' => [
        'driver' => 'session',
        'provider' => 'users',
    ],
],
```

4. Add the `TwoFactorAuthenticatable` trait from `Laravel\Fortify\TwoFactorAuthenticatable` to your authenticable model.
5. Clear config cache:

```
php artisan config:clear
php artisan cache:clear
php artisan optimize:clear
```

Routes
------

[](#routes)

RouteHTTP MethodDescription`/admin/two-factor`GET2FA dashboard: view status, enable/disable 2FA`/admin/setup-two-factor`GETSetup 2FA QR code for the user`/admin/two-factor/enable`POSTEnable 2FA for the logged-in user`/admin/two-factor/disable`POSTDisable 2FA for the logged-in user`/admin/two-factor/recovery-codes`POSTRegenerate recovery codes`/admin/two-factor/recovery-codes-download`POSTDownload recovery codes as a `.txt` file`/admin/two-factor/cancel`GETCancel the 2FA setup flow`/admin/two-factor-challenge`GETDisplay Fortify 2FA login challenge form`/admin/two-factor-challenge`POSTSubmit Fortify 2FA login challenge formAll `/admin` routes use the backpack guard and Backpack admin middleware automatically.

Middleware
----------

[](#middleware)

- `twofactor` → Ensures that users have verified 2FA before accessing protected routes.
- Example usage:

```
Route::group([
    'prefix' => config('backpack.base.route_prefix', 'admin'),
    'middleware' => ['web', 'admin', 'twofactor'],
], function () {
    Route::get('dashboard', [DashboardController::class, 'index']);
});
```

Summary - Package Installation in New Projects
----------------------------------------------

[](#summary---package-installation-in-new-projects)

- `composer require renderbit/backpack-2fa`
- Publish configs &amp; views
- Clear caches
- Done — routes, controllers, and middleware are ready out-of-the-box.

License
-------

[](#license)

MIT License © 2025 Renderbit Technologies

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance69

Regular maintenance activity

Popularity18

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

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

Total

3

Last Release

182d ago

PHP version history (2 changes)1.0.0PHP ^8.1

1.1.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/91018bd70f05127ed12afbb769f24bd6d2c5e90d15970978a7dd8eed9da8c7d5?d=identicon)[renderbit-technologies](/maintainers/renderbit-technologies)

---

Top Contributors

[![AdityaVJ](https://avatars.githubusercontent.com/u/21195870?v=4)](https://github.com/AdityaVJ "AdityaVJ (9 commits)")

---

Tags

backpackcomposer-packagefortifylaravellaravel-packagelaraveltotpauth2faTwo Factor Authenticationfortifybackpack

### Embed Badge

![Health badge](/badges/renderbit-backpack-2fa/health.svg)

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

###  Alternatives

[ellaisys/aws-cognito

AWS Cognito package that allows Auth and other related features using the AWS SDK for PHP

120220.7k1](/packages/ellaisys-aws-cognito)[awes-io/auth

Laravel Authentication package with built-in two-factor (Authy) and social authentication (Socialite).

3826.7k1](/packages/awes-io-auth)[remotemerge/totp-php

Lightweight, fast, and secure TOTP (2FA) authentication library for PHP — battle tested, dependency free, and ready for enterprise integration.

2010.2k](/packages/remotemerge-totp-php)[kamona/kui-laravel-fortify

Front-end scafolding for laravel/fortify based on kui-dashboard

132.7k](/packages/kamona-kui-laravel-fortify)

PHPackages © 2026

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