- Is knpuniversity/guard-bundle a Laravel package?
- No. knpuniversity/guard-bundle is a Symfony bundle built around Symfony's Security component and bundle-extension lifecycle, not a Laravel package. It ships a Bundle subclass and DependencyInjection extension that expect the Symfony kernel and security firewall. Laravel's Auth manager and service providers do not provide the integration points this package requires.
- Can I use KnpUGuardBundle in a Laravel application?
- You should not. There is no Laravel architecture for the bundle to plug into, so Composer may install code but none of the firewall, YAML configuration, or guard service wiring will work. Laravel already covers the same needs through custom guards, Sanctum, Passport, Fortify, or Breeze. Treat this package as a historical Symfony reference, not a Laravel dependency.
- How do I install KnpUGuardBundle?
- Historically it was installed with Composer and registered as a bundle in a Symfony AppKernel, with authenticators wired through security.yml. There is no Laravel service provider or config/auth.php installation path. On modern PHP 8.x and current Symfony components, Composer resolution is likely to fail because the package targets PHP 5.x–7.x and Symfony 2.6–3.x.
- What Laravel versions does KnpUGuardBundle support?
- None. KnpUGuardBundle is a Symfony bundle and does not declare Laravel framework support in any version. It belongs to the Symfony 2.6–3.x era and predates modern Laravel authentication features such as Sanctum and Fortify. Do not plan a Laravel 8, 9, 10, or 11 integration around it.
- What authentication flows does KnpUGuardBundle handle?
- It provides a single GuardAuthenticatorInterface for extracting credentials, loading users, validating them, and controlling success, failure, and challenge behavior. That pattern was used for form login, API tokens, HTTP basic, and social sign-in in Symfony applications. In Laravel, equivalent flows are better implemented with native guards, middleware, and packages such as Sanctum.
- How is KnpUGuardBundle configured?
- Configuration happens through Symfony's security firewalls in security.yml, with guard authenticators registered as services and autowired by the bundle. There is no Laravel config/auth.php or Auth::extend mapping provided by the package. In Laravel you would configure guards and providers natively instead.
- Is KnpUGuardBundle safe for production authentication?
- It is archived and unmaintained, with a single release from 2015 and no CVE response or PHP-version fixes. Authentication code that receives no security review is a liability because failures can be silently permissive or silently rejecting at the auth boundary. For Laravel production use, choose maintained native guards or Sanctum rather than this bundle.
- How do I test a KnpUGuardBundle authenticator?
- You can unit test the GuardAuthenticatorInterface methods in isolation if you vendor the interface, but functional testing depends on Symfony kernel and firewall wiring. There is no Laravel integration to test because the bundle does not register with Laravel's container or Auth manager. For Laravel, test custom guards and middleware using Laravel's authentication testing helpers instead.
- What are the best alternatives to KnpUGuardBundle for Laravel?
- Use Laravel's native authentication guards through Auth::extend and an AuthServiceProvider for custom credential extraction. Use Sanctum or Passport for API tokens, and Fortify or Breeze for scaffolding and common flows. If the real target is legacy Symfony, migrate to Symfony's native authenticator system rather than adopting this bundle.
- How do I migrate away from KnpUGuardBundle?
- For legacy Symfony, move to native Guard if needed and then to the authenticator-based system introduced in Symfony 6, since Guard was deprecated in 5.3. For Laravel, implement a custom guard against Auth::extend or adopt Sanctum for token authentication. Do not add knpuniversity/guard-bundle to composer.json during migration; reuse only the single-class authenticator pattern.