PHPackages                             abdelhamiderrahmouni/laravel-sso - 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. abdelhamiderrahmouni/laravel-sso

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

abdelhamiderrahmouni/laravel-sso
================================

Simple Laravel SSO integration (A fork of nddcoder/laravel-sso based on and zefy/laravel-sso)

v0.1.1(1y ago)04MITPHPPHP &gt;=7.1.3

Since Feb 17Pushed 1y agoCompare

[ Source](https://github.com/abdelhamiderrahmouni/laravel-sso)[ Packagist](https://packagist.org/packages/abdelhamiderrahmouni/laravel-sso)[ Docs](https://github.com/abdelhamiderrahmouni/laravel-sso)[ RSS](/packages/abdelhamiderrahmouni-laravel-sso/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (3)Used By (0)

Simple PHP SSO integration for Laravel
======================================

[](#simple-php-sso-integration-for-laravel)

This package based on [Simple PHP SSO integration for Laravel](https://github.com/zefy/laravel-sso) package.

### Requirements

[](#requirements)

- Laravel 5.5+ (5.5, 6.x, 7.x, 8.x, 9.x, 10.x, 11.x)
- PHP 7.1+|8.0+

### Documentation

[](#documentation)

Please read [Simple PHP SSO integration for Laravel docs](https://github.com/zefy/laravel-sso).

Installation
============

[](#installation)

### Server

[](#server)

Install this package using composer.

```
$ composer require abdelhamiderrahmouni/laravel-sso
```

Copy config file to Laravel project `config/` folder.

```
$ php artisan vendor:publish --provider="AbdelhamidErrahmouni\LaravelSSO\SSOServiceProvider"
```

Create table where all brokers will be saved.

```
$ php artisan migrate --path=vendor/abdelhamiderrahmouni/laravel-sso/database/migrations
```

Edit your `app/Http/Kernel.php` by create new middleware like this:

```
'api' => [
    'throttle:60,1',
    'bindings',
],

'sso' => [
    \App\Http\Middleware\EncryptCookies::class,
    \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
    \Illuminate\Session\Middleware\StartSession::class,
    'bindings',
],

//...
```

Now you should create brokers. You can create new broker using following Artisan CLI command:

```
$ php artisan sso:broker:create {name}
```

---

### Broker

[](#broker)

Install this package using composer.

```
$ composer require abdelhamiderrahmouni/laravel-sso
```

Copy config file to Laravel project `config/` folder.

```
$ php artisan vendor:publish --provider="AbdelhamidErrahmouni\LaravelSSO\SSOServiceProvider"
```

Change `type` value in `config/laravel-sso.php` file from `server`to `broker`.

Set 3 new options in your `.env` file:

```
SSO_SERVER_URL=
SSO_BROKER_NAME=
SSO_BROKER_SECRET=
```

`SSO_SERVER_URL` is your server's http url without trailing slash. `SSO_BROKER_NAME` and `SSO_BROKER_SECRET` must be data which exists in your server's `brokers` table.

Edit your `app/Http/Kernel.php` by adding `\AbdelhamidErrahmouni\LaravelSSO\Middleware\SSOAutoLogin::class` middleware to `$routeMiddleware` array. It should look like this:

```
protected $routeMiddleware = [
    'auto_login' => \AbdelhamidErrahmouni\LaravelSSO\Middleware\SSOAutoLogin::class,
    //...
];
```

Then use like this: [![Use auto_login middleware](https://camo.githubusercontent.com/0f7ad52d521785a44a43850ba6a7583a174e8739ee49c751327a961d8dab617b/68747470733a2f2f692e696d6775722e636f6d2f317033425470312e706e67)](https://camo.githubusercontent.com/0f7ad52d521785a44a43850ba6a7583a174e8739ee49c751327a961d8dab617b/68747470733a2f2f692e696d6775722e636f6d2f317033425470312e706e67)

Last but not least, you need to edit `app/Http/Controllers/Auth/LoginController.php`. You should add two functions into `LoginController` class which will authenticate your client through SSO server but not your Broker page.

```
protected function attemptLogin(Request $request)
{
    $broker = new \AbdelhamidErrahmouni\LaravelSSO\LaravelSSOBroker;

    $credentials = $this->credentials($request);
    return $broker->login($credentials[$this->username()], $credentials['password']);
}

public function logout(Request $request)
{
    $broker = new \AbdelhamidErrahmouni\LaravelSSO\LaravelSSOBroker;

    $broker->logout();

    $this->guard()->logout();

    $request->session()->invalidate();

    return redirect('/');
}
```

That's all. For other Broker pages you should repeat everything from the beginning just changing your Broker name and secret in configuration file.

Example `.env` options:

```
SSO_SERVER_URL=https://server.test
SSO_BROKER_NAME=site1
SSO_BROKER_SECRET=892asjdajsdksja74jh38kljk2929023
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance43

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity24

Early-stage or recently created project

 Bus Factor1

Top contributor holds 64.3% 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.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

450d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/745a0575996f5a3dcb6b8e177e5f37e610d83906028a1e99aa2ec3213a281027?d=identicon)[abdelhamiderrahmouni](/maintainers/abdelhamiderrahmouni)

---

Top Contributors

[![dangdungcntt](https://avatars.githubusercontent.com/u/22521948?v=4)](https://github.com/dangdungcntt "dangdungcntt (9 commits)")[![abdelhamiderrahmouni](https://avatars.githubusercontent.com/u/26693672?v=4)](https://github.com/abdelhamiderrahmouni "abdelhamiderrahmouni (5 commits)")

---

Tags

laravelAuthenticationSSOlogin

###  Code Quality

Static AnalysisRector

### Embed Badge

![Health badge](/badges/abdelhamiderrahmouni-laravel-sso/health.svg)

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

###  Alternatives

[zefy/laravel-sso

Simple PHP SSO integration for Laravel

1013.0k](/packages/zefy-laravel-sso)[maicol07/laravel-oidc-client

OpenID Connect Client for Laravel

251.1k](/packages/maicol07-laravel-oidc-client)

PHPackages © 2026

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