scheb/2fa-email
Adds email-based two-factor authentication to Symfony apps using Scheb’s 2FA bundle. Generates and delivers one-time codes via email, supports custom mailers/templates, code validation and trusted devices, for an extra login security layer.
scheb/2fa-email) extends scheb/2fa-bundle to add email-based 2FA, making it a niche but valuable addition for applications requiring non-TOTP (time-based) 2FA (e.g., legacy systems, environments without SMS/TOTP support, or user preference flexibility).scheb/2fa-bundle (via Laravel’s Symfony bridge or standalone). Assumes Laravel’s authentication stack (e.g., Illuminate\Auth) and mail services (e.g., Illuminate\Mail).throttle middleware or custom logic).TwoFactorAuthEvent), allowing customization (e.g., email templates, validation logic).scheb/2fa-bundle (≥v4.0) or standalone scheb/two-factor-auth (≥v7.0).scheb/2fa-bundle's storage (e.g., Doctrine, Eloquent).composer.json, publish config (php artisan vendor:publish), and bind to Laravel’s auth guard.// config/auth.php
'guards' => [
'web' => [
'provider' => 'users',
'two_factor' => true, // Enable 2FA
],
],
scheb/2fa-bundle compatibility).Illuminate\Auth (e.g., users table). Requires remember_token column if using persistent logins.Mail facade (e.g., Mail::send()). Supports Markdown/Blade templates for customization.Illuminate\Auth\Events\Attempting) for hooks.scheb/2fa-bundle directly, ensure Laravel’s Symfony bridge is configured (e.g., symfony/http-foundation).scheb/2fa-bundle's tables (e.g., two_factor_auth_backup_codes).scheb/2fa-bundle (or standalone scheb/two-factor-auth)..env):
MAIL_MAILER=smtp
MAIL_HOST=mail.example.com
composer require scheb/2fa-email
php artisan vendor:publish --provider="Scheb\TwoFactorBundle\SchebTwoFactorBundle" --tag="config"
config/auth.php to enable 2FA for guards.resources/views/vendor/scheb_two_factor/).config/scheb_two_factor.php:
'email' => [
'code_length' => 6,
'time_to_live' => 600, // 10 minutes
],
two_factor.auth middleware:
Route::middleware(['web', 'two_factor.auth'])->group(function () {
// Protected routes
});
Mail::fake()).scheb/2fa-bundle compatibility).laravel-2fa). Ensure single source of truth for 2FA logic.scheb/2fa-bundle for breaking changes.config/scheb_two_factor.php) for consistency.scheb/2fa-email and scheb/2fa-bundle versions in composer.json to avoid surprises.How can I help you explore Laravel packages today?