symfonycasts/reset-password-bundle
Symfony bundle to implement secure, time-limited password reset flows. Generates reset tokens, validates expiry and one-time use, and provides helpers to send reset emails and update passwords. Integrates with Doctrine and Symfony security.
Illuminate\Auth\Passwords but with Symfony’s opinionated structure (e.g., Doctrine ORM dependency, Symfony Mailer).laravel/breeze or laravel/jetstream already include password resets, reducing urgency unless Symfony-specific features (e.g., UX patterns, event-driven workflows) are desired./reset-password/{token}) via Symfony’s HTTP client or API Platform.Auth::attempt() or a custom service.SwiftMailer or Mailable classes.| Risk Area | Mitigation Strategy |
|---|---|
| ORM Incompatibility | Use a shared database schema (e.g., PostgreSQL) or sync tables via migrations. |
| State Management | Implement a queue (e.g., Laravel Queues + Symfony Messenger) for async token generation. |
| Authentication Flow | Mock Symfony’s Security component in Laravel tests or use a hybrid auth system. |
| Dependency Bloat | Containerize the Symfony bundle to isolate dependencies (e.g., Docker + API calls). |
PasswordBroker)?Recommended Architecture:
reset-password-service) behind an API gateway (Laravel + Symfony API Platform)./api/reset-password for token validation/resets.PasswordResetToken logic) in Laravel via Symfony’s Component Installer.PasswordResetTokenManager to a custom service).Shared Dependencies:
password_resets table) or sync via Laravel’s migrations + Symfony’s schema updates.Mailable or adapt Symfony’s Email component to Laravel’s SwiftMailer.curl or Postman.POST /reset, GET /validate).GuzzleHttp).PasswordBroker to delegate to the Symfony API.// Laravel Service
public function sendResetLink(User $user) {
$response = Http::post('http://symfony-service/api/reset', [
'email' => $user->email
]);
return $response->json();
}
Illuminate\Cache\Repository + Symfony API retries).| Component | Laravel Equivalent | Compatibility Notes |
|---|---|---|
| Doctrine ORM | Eloquent | Use a shared abstract model or sync tables via migrations. |
| Symfony Mailer | Laravel Mailable/SwiftMailer | Standardize on Laravel’s Mailable or create a wrapper for Symfony’s Email. |
| Security Component | Laravel Auth | Mock Symfony’s UserProvider or use Laravel’s Authenticatable interface. |
| Event Dispatcher | Laravel Events | Subscribe to Symfony events via API calls or use a shared event bus (e.g., RabbitMQ). |
password_resets table).GET /reset/{token}).RateLimiter vs. Laravel’s throttle middleware).Symfony\Bundle\FrameworkBundle\Templating\EngineException).Monolog) with correlation IDs.Mail facade).PasswordBroker").Elasticsearch for shared analytics (if needed).Events).database queue.password_resets table may become a bottleneck.created_at or shard by user ID.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Symfony API downtime | No password resets | Fallback to Laravel’s PasswordBroker with cached tokens. |
| Database connection issues | Token validation fails | Local cache (Redis) for recent tokens + async retry. |
| Email delivery failures | Users don’t receive resets | Dual email providers (Symfony + Laravel) with fallback logic. |
| Token generation race conditions | Duplicate |
How can I help you explore Laravel packages today?