- Can I use MyAuthBundle in a Laravel project instead of Symfony?
- No, this bundle is designed exclusively for Symfony applications. Laravel uses a different architecture, and the bundle relies heavily on Symfony’s SecurityBundle, Form, and Mailer components. If you need Laravel-specific auth, consider alternatives like Laravel Breeze or Sanctum.
- What Laravel/Symfony versions does MyAuthBundle support?
- The bundle requires Symfony 6.4 or higher and PHP 7.4/8.0. It does not support Laravel or older Symfony versions. Check your stack compatibility before installation, as downgrading Symfony may not be feasible.
- How do I customize the user entity if my app uses a different schema?
- You can configure the bundle to use your custom user entity via the `my_auth.yaml` configuration. However, the bundle assumes fields like `emailVerifiedAt` exist, so you may need to add migrations or adjust your entity to match its expectations.
- Does MyAuthBundle support multi-factor authentication (MFA) or OAuth?
- Out of the box, no. The bundle focuses on basic authentication, email verification, and password resets. For MFA or OAuth, you’d need to integrate third-party bundles like LexikJWTAuthenticationBundle or SymfonyConnect’s OAuth bundles separately.
- How do I integrate MyAuthBundle with my existing Twig/React frontend?
- The bundle provides form types (e.g., `RegistrationType`, `LoginType`) that you can use in your templates. For Twig, include the form blocks directly. For React, you’ll need to adapt the form logic to your frontend framework, possibly by exposing API endpoints for form submissions.
- Is there brute-force protection or rate-limiting for login attempts?
- The bundle does not include built-in brute-force protection. You’ll need to implement this manually, likely using Symfony’s firewall configuration or a third-party bundle like Symfony’s `security.http_basic` or custom voter logic.
- Can I customize email templates for verification and password resets?
- Yes, the bundle allows you to override email templates via configuration. You can define custom paths for verification and reset emails in `my_auth.yaml`, and it supports Twig templates for dynamic content.
- What are the performance implications of using MyAuthBundle?
- The bundle adds minimal overhead, primarily for database queries (e.g., checking `emailVerifiedAt`) and email sending. For high-traffic apps, ensure your database and email service (e.g., Symfony Mailer) are optimized. Caching strategies can be added via Symfony’s cache system if needed.
- Are there alternatives to MyAuthBundle for Symfony authentication?
- Yes, consider Symfony’s built-in SecurityBundle for basic auth, FOSUserBundle for a more feature-rich solution, or LexikJWTAuthenticationBundle for API-based authentication. Evaluate your needs—MyAuthBundle is lightweight but less battle-tested than these alternatives.
- How do I handle testing (unit/integration) for MyAuthBundle?
- Test email flows by mocking Symfony’s Mailer component in your tests. For authentication, use Symfony’s `LoginLink` or `AuthenticationUtils` in functional tests. Edge cases like duplicate emails or failed logins should be validated with test users and assertions for expected behaviors.