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

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

webmonks/laravel-2fa
====================

🔐 Plug &amp; Play Laravel 2FA - Email OTP, SMS OTP, TOTP, WebAuthn/FIDO2, Recovery Codes with Multi-Auth Guard Support. Production-ready in 30 seconds!

1.2.0(7mo ago)132MITPHPPHP ^8.1CI failing

Since Sep 23Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/webmonks-technologies/laravel-2fa)[ Packagist](https://packagist.org/packages/webmonks/laravel-2fa)[ Docs](https://github.com/webmonks-technologies/laravel-2fa)[ RSS](/packages/webmonks-laravel-2fa/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (37)Versions (3)Used By (0)

Laravel 2FA
===========

[](#laravel-2fa)

[![Latest Version on Packagist](https://camo.githubusercontent.com/5d773855cc836f546cba8e85291fdf96e83eccff888ab99d1c27fe504aa2d611/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7765626d6f6e6b732f6c61726176656c2d3266612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/webmonks/laravel-2fa)[![GitHub Tests Action Status](https://camo.githubusercontent.com/41992f90568cea09e13dd4f51063de3a2fadacde3296d5f4557ee301c802e53f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7765626d6f6e6b732d746563686e6f6c6f676965732f6c61726176656c2d3266612f74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/webmonks-technologies/laravel-2fa/actions?query=workflow%3Atests+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/545f2b51ff3d7326fdbd22701bdb31f40b6d938c754ee1048200aac50c9ae238/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7765626d6f6e6b732f6c61726176656c2d3266612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/webmonks/laravel-2fa)[![PHP Version Require](https://camo.githubusercontent.com/2735ed54050092e805c40b09b663725a90e7fda083e999756575294e1c13002b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7765626d6f6e6b732f6c61726176656c2d3266613f7374796c653d666c61742d737175617265)](https://packagist.org/packages/webmonks/laravel-2fa)[![License](https://camo.githubusercontent.com/c5d54191337588a7830d9985c0bb8328c41b0708729f4f2f6311830e7e87d3ac/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f7765626d6f6e6b732d746563686e6f6c6f676965732f6c61726176656c2d3266613f7374796c653d666c61742d737175617265)](https://github.com/webmonks-technologies/laravel-2fa/blob/main/LICENSE.md)

**The definitive Laravel 2FA package with true plug-and-play architecture. Zero configuration required - works instantly with Laravel Mail, then scales to enterprise needs with WhatsApp, Voice, Push Notifications, and custom delivery providers.**

Transform your Laravel authentication from basic to bulletproof in 30 seconds. Unlike other 2FA packages that force you into rigid patterns, Laravel 2FA v1.1 gives you the freedom to start simple and customize everything as your requirements evolve - now with global reach through WhatsApp, Voice calls, Push notifications, and intelligent fallback systems.

Why Laravel 2FA?
----------------

[](#why-laravel-2fa)

**🚀 30-Second Setup**: Install, migrate, protect routes - done. Email OTP works immediately with your existing Laravel Mail configuration.

**🔌 True Plug &amp; Play**: Start with zero configuration, then customize anything. No vendor lock-in, no forced dependencies, no architectural constraints.

**🎯 Production Battle-Tested**: 96 comprehensive tests, 227 assertions, extensive security features, and real-world deployment experience.

**🏗️ Enterprise-Ready Architecture**: Multi-auth support, device trust management, comprehensive rate limiting, audit logging, and extensible provider system.

Key Features
------------

[](#key-features)

### 🔐 Complete 2FA Methods

[](#-complete-2fa-methods)

- **Email OTP** (zero-config) - Works instantly with Laravel Mail
- **SMS OTP** - Twilio, Vonage/Nexmo, AWS SNS with fallback chains
- **WhatsApp OTP** - Twilio WhatsApp &amp; WhatsApp Business API
- **Voice Call OTP** - Multi-language voice calls with customizable voices
- **Push Notifications** - FCM (Android/iOS/Web) &amp; APNS (iOS) with approval workflows
- **TOTP/Google Authenticator** - Time-based codes with QR generation
- **Recovery Codes** - Secure backup authentication system

### 🛡️ Enterprise Security

[](#️-enterprise-security)

- **Multi-Auth Guards**: Native support for web, admin, api, customer - any authentication guard
- **Advanced Fallback System**: Multi-provider chains with intelligent failover
- **Device Trust Management**: Remember trusted devices with configurable expiration
- **Rate Limiting**: Brute force protection with configurable thresholds
- **End-to-End Encryption**: All sensitive data encrypted at rest
- **Comprehensive Audit Logging**: Track all 2FA events and security incidents

### 🔧 Developer Experience

[](#-developer-experience)

- **True Plug &amp; Play**: Works in 30 seconds with zero configuration
- **100% Customizable**: Override providers, templates, logic, UI - or use sensible defaults
- **Custom Delivery Providers**: Slack, Discord, Telegram integration examples
- **Extensible Architecture**: Create custom providers for any delivery method
- **95%+ Test Coverage**: Production-ready with PestPHP testing framework
- **Laravel 10, 11, 12+ Ready**: Modern Laravel compatibility with future-proof architecture

Requirements
------------

[](#requirements)

- **PHP**: 8.1+ minimum
- **Laravel**: 10.0+ (supports 11.x, 12.x)
- **Optional Providers**: Twilio SDK, Vonage, AWS SNS, FCM, APNS for enhanced 2FA methods

Quick Start (30 Seconds)
------------------------

[](#quick-start-30-seconds)

### 1. Install &amp; Setup

[](#1-install--setup)

```
composer require webmonks/laravel-2fa
php artisan two-factor:install
php artisan migrate
```

### 2. Prepare Your User Model

[](#2-prepare-your-user-model)

```
