- Can I use ecphp/cas-bundle in a Laravel application?
- No, not natively. ecphp/cas-bundle is a Symfony bundle that registers its services through Symfony's dependency injection container and depends on symfony/security-bundle and Symfony's AuthenticatorInterface. Laravel's Illuminate\Auth guard stack is architecturally different, so the bundle cannot be dropped into a Laravel app without significant abstraction work.
- How do I add CAS single sign-on to a Laravel app if this bundle does not work there?
- Use the underlying ecphp/cas-lib (PHP-CAS) library directly, since it is PHP-agnostic and not tied to Symfony. Build a custom class implementing Laravel's Guard contract to validate CAS tickets, add middleware that redirects unauthenticated requests to the CAS login endpoint, and map the returned attributes onto your Eloquent user model. Expect a meaningful amount of work for an MVP, as this bypasses the bundle's ready-made Symfony wiring.
- Which Symfony versions and security setups does ecphp/cas-bundle support?
- The bundle targets modern Symfony (6 and 7) and uses the authenticator-based security system introduced in Symfony 5.3, including EntryPoint and AuthenticatorInterface patterns. Integration is done through security.yaml by wiring the provided CAS authenticator into a firewall. If your application still relies on the legacy Guard system, you should plan an upgrade path before adopting the bundle.
- How do I install and configure ecphp/cas-bundle in a Symfony application?
- Install it with composer require ecphp/cas-bundle and enable the bundle in your kernel or bundles.php. Then configure a firewall in security.yaml with the cas_authenticator entry, and provide a user provider that turns CAS responses into your application's user objects. The full configuration reference is published on the dedicated Read the Docs site.
- Does ecphp/cas-bundle support different CAS protocol versions, proxies, and single sign-on workflows?
- Yes. The bundle supports CAS protocol versions 1 and 3, handles attributes returned in the CAS response, and covers proxy and single sign-on workflows through ecphp/cas-lib. You should still validate the exact protocol version and attribute release behaviour of your target CAS server, such as Apereo CAS, before relying on those features in production.
- How do I map CAS attributes, like email or groups, to my Laravel or Symfony user model?
- CAS responses include an attribute bag, for example cas:attributes.email. In Symfony you map these inside your UserProviderInterface implementation; in Laravel you would read the same attributes inside your custom guard or user provider and assign them to Eloquent model properties. Persisting users locally on first login is a common approach so that roles and application-specific data can be attached afterwards.
- How can I test CAS authentication locally before connecting to a production CAS server?
- Run a local CAS server such as apereo/cas in Docker and point the bundle or your custom guard at it. This lets you verify the full login flow, attribute release, and proxyGrantingTicket behaviour without touching production. Add automated tests around your user provider and guard so regressions in attribute mapping are caught early.
- What are the alternatives to ecphp/cas-bundle for CAS authentication in Laravel?
- The most direct option is ecphp/cas-lib with a custom Laravel guard and middleware. Other approaches include using another PHP CAS client library, or hosting the Symfony bundle in a separate microkernel and bridging to it, which is significantly more complex. Weigh maintenance burden, attribute handling, and how much CAS-specific protocol logic you want to own when choosing.
- Is ecphp/cas-bundle actively maintained, and what is the deprecation risk?
- The package is part of the ECphp project with published documentation and CI workflows, and its Symfony deprecation risk is relatively low because it targets the current Symfony 6 and 7 security architecture. The bigger risk sits with Laravel adopters, who depend on ecphp/cas-lib rather than the bundle itself. Monitor upstream releases and decide in advance whether forking the library is acceptable if breaking changes appear.
- What happens if the CAS server is unavailable, and how do I configure a fallback?
- The bundle provides the CAS entry point, but you should still design a fallback path so users are not locked out during CAS outages. In Symfony this usually means keeping a form_login or other local authenticator in the same firewall; in Laravel you would handle it inside your middleware by redirecting to a local login or a clear error page. Test the outage scenario explicitly, because silent failures in the CAS redirect chain are hard to diagnose in production.