PHPackages                             modernmcguire/drawbridge - 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. modernmcguire/drawbridge

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

modernmcguire/drawbridge
========================

Add 2FA support to your Laravel Application

1.0.1(2y ago)0335[1 PRs](https://github.com/modernmcguire/drawbridge/pulls)MITPHPPHP ^8.1

Since Mar 5Pushed 1y ago1 watchersCompare

[ Source](https://github.com/modernmcguire/drawbridge)[ Packagist](https://packagist.org/packages/modernmcguire/drawbridge)[ Docs](https://github.com/modernmcguire/drawbridge)[ GitHub Sponsors]()[ RSS](/packages/modernmcguire-drawbridge/feed)WikiDiscussions main Synced today

READMEChangelog (5)Dependencies (12)Versions (7)Used By (0)

Driver-based 2FA for Laravel
============================

[](#driver-based-2fa-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/ad75128499eeff562edbe60acd3a28fd0c9df86549bd52b6744affe3ba8dd54a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6f6465726e6d6367756972652f647261776272696467652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/modernmcguire/drawbridge)[![GitHub Tests Action Status](https://camo.githubusercontent.com/d3214a924cae4be6886ad96c1d8be36abed258b18d11fb6c17a64eb9b2c74088/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d6f6465726e6d6367756972652f647261776272696467652f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/modernmcguire/drawbridge/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/c6a1a876298a83fcc61f87638c39b540f717f16dab3f87cdc9d2a5230f5f2d62/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d6f6465726e6d6367756972652f647261776272696467652f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/modernmcguire/drawbridge/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/0bf37015414426b6ac55107e71ff79a7523f1526cb9fe8679257b35a55ecfb45/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6f6465726e6d6367756972652f647261776272696467652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/modernmcguire/drawbridge)

Add 2FA support to your Laravel Application!

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

[](#installation)

You can install the package via composer:

```
composer require modernmcguire/drawbridge
```

You can publish and run the migrations with:

```
php artisan vendor:publish --tag="drawbridge-migrations"
php artisan migrate
```

You can publish the config file with:

```
php artisan vendor:publish --tag="drawbridge-config"
```

Optionally, you can publish the login and email using

```
php artisan vendor:publish --tag="drawbridge-views"
```

Config
------

[](#config)

The package has multiple drivers to choose from. You can set the driver in the config file or your env.

```
'default_driver' => env('OTP_DRIVER', 'email'),
```

> Note: Currently the only one that is setup is the email driver.

Usage
-----

[](#usage)

1. Run Migrations
2. Apply the `HandlesOTP` trait to your User model
3. Set `two_factor_enabled` to true on the user
4. Login!

You will be redirected to a page to enter your OTP code.

Database
--------

[](#database)

New database fields will be added to your `users` table.

FieldDescriptiontwo\_factor\_enabledWhether two-factor authentication is enabledotp\_secretThe OTP code to match againstotp\_secret\_expires\_atThe time the OTP code expires (default: 5 minutes)Testing
-------

[](#testing)

```
composer test
```

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)

- [Ben Miller](https://github.com/modernben)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance26

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87.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 ~1 days

Total

5

Last Release

847d ago

Major Versions

0.1.2 → 1.0.02024-03-08

### Community

Maintainers

![](https://www.gravatar.com/avatar/71c1ed28974c5a60df0a84f0c98ecf9d9c421e988ce7a9cfd28ae06a500599d9?d=identicon)[modernben](/maintainers/modernben)

---

Top Contributors

[![modernben](https://avatars.githubusercontent.com/u/67608755?v=4)](https://github.com/modernben "modernben (14 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

authenticationemaillaravelmagic-linkstwo-factor-authenticationlaravelAuthenticationemailTwo Factor Authenticationmagic-linksModern McGuiredrawbridge

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/modernmcguire-drawbridge/health.svg)

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

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k102.4M1.4k](/packages/spatie-laravel-permission)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[spatie/laravel-passkeys

Use passkeys in your Laravel app

471890.7k39](/packages/spatie-laravel-passkeys)[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.1k11.2M100](/packages/dedoc-scramble)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[wnx/laravel-backup-restore

A package to restore database backups made with spatie/laravel-backup.

213420.9k2](/packages/wnx-laravel-backup-restore)

PHPackages © 2026

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