PHPackages                             teuz/laravel-cas - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. teuz/laravel-cas

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

teuz/laravel-cas
================

A CAS authentication package for Laravel 4.

8601PHP

Since Jan 27Pushed 12y ago1 watchersCompare

[ Source](https://github.com/Fnatte/laravel-cas)[ Packagist](https://packagist.org/packages/teuz/laravel-cas)[ RSS](/packages/teuz-laravel-cas/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

CAS for Laravel 4
=================

[](#cas-for-laravel-4)

*teuz/laravel-cas* is a CAS authentication package for Laravel 4.

**Please be aware that this package is in a early development stage and is not very well tested!**

Installation
------------

[](#installation)

Add requirement of *teuz/laravel-cas* to your composer.json file:

```
"require": {
	"laravel/framework": "4.1.*",
	"teuz/laravel-cas": "dev-master"
},
```

Update composer using a terminal:

```
composer update

```

Add service providers to *app/config/app.php*: **(Note that both service providers below are required)**

```
'Teuz\LaravelCas\LaravelCasServiceProvider',
'\anlutro\cURL\Laravel\cURLServiceProvider',
```

**(Recommended)** Add alias to *app/config/app.php*:

```
'Cas' => 'Teuz\LaravelCas\Facades\Cas'

```

Publish package config using a terminal:

```
php artisan config:publish teuz/laravel-cas

```

Configuration
-------------

[](#configuration)

The configuration file is located at *app/config/packages/teuz/laravel-cas/config.php*.

There are four parameters to configure:

- url - The url to the CAS server (e.g. "")
- service - Service url that is sent to the CAS-server. This should point to a route that performs a Cas::check().
- userField - Name of the user identifier key shared between the CAS server and user object. (E.g. "username")
- createUsers - Whether or not to create users. If false, missing users in the database will not be logged in even though they are correctly validated by the CAS erver.

Usage
-----

[](#usage)

There are four functions of importance: *login*, *check*, *reload* and *logout*.

### Login

[](#login)

The login function should be called when you want the user to be redirected to the CAS login page. One approach is to add this call to the auth callback:

In *app/filters.php*:

```
Route::filter('auth', function()
{
	if (Auth::guest())
	{
		return Cas::login();
	}
});
```

Everytime you add this filter to a route, user that are not logged in will be redirected to the CAS login page.

### Check and reload

[](#check-and-reload)

The check function is used to validate CAS tickets. A route should be added that calls this function:

```
Route::get('/user/cas', function()
{
	if(Cas::check()) return Cas::reload();
});
```

**Note that this path should be equal to the configuration parameter *service*.**When the user submits the login form at the CAS server, the user will be redirected to this route with a ticket. We must then validate the ticket, and if we successfully do so redirect the user to the intended page (using the *reload* function).

### Logout

[](#logout)

The function used to logout the user:

```
Route::get('/user/logout', function()
{
	if(Auth::guest() === false)
	{
		return Cas::logout();
	}
	else
	{
		return Redirect::to('/');
	}
});
```

License
-------

[](#license)

Copyright 2014 Teuz

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

```
http://www.apache.org/licenses/LICENSE-2.0

```

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/01b19f1e17b45042d94293089cf284244106c19e056aa8ab1033ba13421e03f5?d=identicon)[Fnatte](/maintainers/Fnatte)

---

Top Contributors

[![fnatte](https://avatars.githubusercontent.com/u/1225694?v=4)](https://github.com/fnatte "fnatte (10 commits)")

### Embed Badge

![Health badge](/badges/teuz-laravel-cas/health.svg)

```
[![Health](https://phpackages.com/badges/teuz-laravel-cas/health.svg)](https://phpackages.com/packages/teuz-laravel-cas)
```

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

41721.2M118](/packages/league-oauth2-google)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
