Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Cas Lib Laravel Package

ecphp/cas-lib

Laravel-oriented PHP CAS (Central Authentication Service) library for integrating SSO into your app. Provides CAS client features like login/logout handling, ticket validation, and user attribute retrieval, aiming for straightforward setup and compatibility with common CAS servers.

View on GitHub
Deep Wiki
Context7

CAS Lib, a standard library for CAS authentication.

Frequently asked questions about Cas Lib
Does this package support Laravel 10+ and PHP 8.2+?
The package is PHP 8.0+ compatible and works with Laravel 8+. While it may technically support newer versions, test thoroughly as the low-maintenance status means no explicit Laravel 10+ guarantees exist. Check the [documentation](https://ecphp-cas-lib.readthedocs.io/) for version-specific notes.
How do I integrate CAS authentication into Laravel’s middleware?
Use Laravel’s middleware pipeline to wrap CAS logic. Create a custom middleware (e.g., `CASAuthMiddleware`) that instantiates the CAS client from the package and validates tickets before allowing route access. Bind the CAS client to Laravel’s service container for dependency injection.
Which CAS protocol versions (v1/v3/v4) does this library support?
The package primarily supports CAS 3.0 (the modern standard for SSO). CAS 1.0 and 2.0 are deprecated and unsupported. Verify your CAS server’s version matches the package’s capabilities, as misalignment can cause authentication failures or security risks.
How does this package handle CAS token storage in Laravel?
The library relies on server-side sessions for token storage, which integrates with Laravel’s session drivers (file, database, Redis, etc.). However, you may need custom logic to ensure tokens persist correctly across requests, especially for long-lived sessions or distributed setups.
Are there Laravel-specific helpers or middleware included?
No, this is a generic PHP CAS library. You’ll need to build Laravel-specific components like middleware, service providers, and route guards manually. The package provides the core CAS client logic, but integration requires custom Laravel boilerplate.
What happens if CAS authentication fails (e.g., invalid ticket)?
The package throws exceptions for CAS errors (e.g., invalid tickets, server failures). You can catch these exceptions in Laravel middleware or controllers and redirect users to a fallback auth method (e.g., local login) or a custom error page. Logging is recommended for debugging.
Can I use this package with Laravel’s Breeze/Jetstream for hybrid auth?
Yes, but you’ll need to extend Laravel’s auth system to support CAS alongside Breeze/Jetstream. Use middleware to redirect unauthenticated CAS users to the CAS login flow, then merge CAS user attributes with Laravel’s `User` model. Test thoroughly to avoid conflicts in session management.
Is this package actively maintained? What if I encounter issues?
The package has low stars (18) and no clear maintenance roadmap, indicating potential risks. Issues should be reported via GitHub, but responses may be slow. Consider forking or contributing if critical fixes are needed. Alternatives like custom middleware or Laravel-specific CAS packages may offer better support.
How do I test CAS authentication in a Laravel app?
Mock the CAS server in tests (e.g., using a local test CAS instance like [CasTestServer](https://github.com/Jasig/cas-test-server)). Test ticket validation, attribute retrieval, and logout flows in Laravel’s PHPUnit environment. Use Laravel’s `actingAs` or session mocking to simulate authenticated CAS users.
Should I use this package or a custom CAS middleware for Laravel?
Use this package if you need a battle-tested CAS client with minimal overhead and don’t require Laravel-specific features. For tighter Laravel integration (e.g., built-in middleware, service providers, or Jetstream compatibility), consider writing custom middleware or exploring alternatives like `spomky-labs/ldap` if LDAP/CAS hybrid setups are needed.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor
spatie/laravel-javascript-views