dragonzap/2fa
Laravel 2FA package with email-based codes by default and optional TOTP for Google/Microsoft Authenticator. Protect routes via the twofactor middleware (always or if-enabled). Publish config, run migrations, and override classes to fully customize the flow.
MustVerifyEmail, Authenticatable), enabling seamless adoption in existing auth flows.php-otp (TOTP/HOTP), pragmarx/google2fa (Google Authenticator), or overtrue/sms (SMS-based 2FA).Hash, Crypt, and Session services.backup_codes, two_factor_secret, and recovery_codes tables.users) if not namespaced properly.@2fa Blade directive and TwoFactorMiddleware for route protection.backup_code checks could impact query performance.composer.json constraints).TwoFactorMiddleware doesn’t block API tokens.spatie/laravel-2fa or laravel-breeze-2fa, avoid duplication.composer require dragonzap/2fa.php artisan vendor:publish --provider="DragonZap\TwoFA\TwoFAServiceProvider".config/twofa.php (e.g., allowed providers, backup code settings).@2fa or TwoFactorMiddleware.Route::middleware(['auth', '2fa'])->group(function () {
// 2FA-protected routes
});
two_factor_secret and backup_code tables.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Database downtime | Users locked out of 2FA flows | Fallback to email-based recovery. |
| SMS provider outage | SMS 2FA fails | Offer TOTP/HOTP as secondary method. |
| Backup code leakage | Security breach | Rotate codes immediately; log suspicious access. |
| TOTP drift (time sync) | Failed authentications | Sync server time with NTP; add tolerance buffer. |
| Package abandonment | No security updates | Fork and maintain; migrate to alternative. |
How can I help you explore Laravel packages today?