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

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

vduit/laravel-sso
=================

Simple PHP SSO integration for Laravel

1.0.8(5y ago)018MITPHPPHP &gt;=7.2

Since Mar 1Pushed 5y agoCompare

[ Source](https://github.com/vduit/laravel-sso)[ Packagist](https://packagist.org/packages/vduit/laravel-sso)[ Docs](https://github.com/zefy/laravel-sso)[ RSS](/packages/vduit-laravel-sso/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (3)Versions (10)Used By (0)

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

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

[![Latest Stable Version](https://camo.githubusercontent.com/191bd3775cc2e245ed12f1cef8ed04fd9b5fd782d11038f04c5ec4fa52d342f1/68747470733a2f2f706f7365722e707567782e6f72672f7a6566792f6c61726176656c2d73736f2f762f737461626c65)](https://packagist.org/packages/zefy/laravel-sso)[![Total Downloads](https://camo.githubusercontent.com/e925605badc337b5461e400b20c1503e4cc66c5f7f70bb54b993c96ac47e5211/68747470733a2f2f706f7365722e707567782e6f72672f7a6566792f6c61726176656c2d73736f2f646f776e6c6f616473)](https://packagist.org/packages/zefy/laravel-sso)[![Latest Unstable Version](https://camo.githubusercontent.com/9fa9258e184558c43257d19122cd228dca00d44e3590ed53be7c87dfab3bd84e/68747470733a2f2f706f7365722e707567782e6f72672f7a6566792f6c61726176656c2d73736f2f762f756e737461626c65)](https://packagist.org/packages/zefy/laravel-sso)[![License](https://camo.githubusercontent.com/f911616e20d8720b3b43fa8c5117b85bee404d37d9dcc539fff88ac32f7ecf01/68747470733a2f2f706f7365722e707567782e6f72672f7a6566792f6c61726176656c2d73736f2f6c6963656e7365)](https://packagist.org/packages/zefy/laravel-sso)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/d0811625fc1efb7995ea4347abeee1be388cc40fc053cacc67620ab6ea97be87/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7a6566792f6c61726176656c2d73736f2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/zefy/laravel-sso/?branch=master)[![Build Status](https://camo.githubusercontent.com/ba0a45558d1c4bef9a5604c2c1b0607361cf98a17e29277a8a49b2a9e09a3ba3/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7a6566792f6c61726176656c2d73736f2f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/zefy/laravel-sso/build-status/master)[![Code Intelligence Status](https://camo.githubusercontent.com/901ca9b15919822152f6caa608a23984abe8b1f75f29c4880a6429503d23a529/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7a6566792f6c61726176656c2d73736f2f6261646765732f636f64652d696e74656c6c6967656e63652e7376673f623d6d6173746572)](https://scrutinizer-ci.com/code-intelligence)

[![](https://camo.githubusercontent.com/640c3d52b2764f179ef3cf089b604516a8c4ac0a06f055a46c6a7fce9428b787/68747470733a2f2f6c61726176656c2e636f6d2f6173736574732f696d672f636f6d706f6e656e74732f6c6f676f2d6c61726176656c2e737667)](https://camo.githubusercontent.com/640c3d52b2764f179ef3cf089b604516a8c4ac0a06f055a46c6a7fce9428b787/68747470733a2f2f6c61726176656c2e636f6d2f6173736574732f696d672f636f6d706f6e656e74732f6c6f676f2d6c61726176656c2e737667)

This package based on [Simple PHP SSO skeleton](https://github.com/zefy/php-simple-sso) package and made suitable for Laravel framework.

### Requirements

[](#requirements)

- Laravel 5.5+
- PHP 7.1+

### Words meanings

[](#words-meanings)

- ***SSO*** - Single Sign-On.
- ***Server*** - page which works as SSO server, handles authentications, stores all sessions data.
- ***Broker*** - your page which is used visited by clients/users.
- ***Client/User*** - your every visitor.

### How it works?

[](#how-it-works)

Client visits Broker and unique token is generated. When new token is generated we need to attach Client session to his session in Broker so he will be redirected to Server and back to Broker at this moment new session in Server will be created and associated with Client session in Broker's page. When Client visits other Broker same steps will be done except that when Client will be redirected to Server he already use his old session and same session id which associated with Broker#1.

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

[](#installation)

### Server

[](#server)

Install this package using composer.

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

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

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

Create table where all brokers will be saved.

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

Edit your `app/Http/Kernel.php` by removing throttle middleware and adding sessions middleware to `api` middlewares array. This is necessary because we need sessions to work in API routes and throttle middleware can block connections which we need.

```
'api' => [
    'bindings',
    \Illuminate\Session\Middleware\StartSession::class,
],
```

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 zefy/laravel-sso
```

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

```
$ php artisan vendor:publish --provider="Zefy\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 `\Zefy\LaravelSSO\Middleware\SSOAutoLogin::class` middleware to `web` middleware group. It should look like this:

```
protected $middlewareGroups = [
        'web' => [
            ...
            \Zefy\LaravelSSO\Middleware\SSOAutoLogin::class,
        ],

        'api' => [
            ...
        ],
    ];
```

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 \Zefy\LaravelSSO\LaravelSSOBroker;

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

public function logout(Request $request)
{
    $broker = new \Zefy\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

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 58.5% 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 ~143 days

Recently: every ~282 days

Total

9

Last Release

1848d ago

PHP version history (2 changes)1.0.0PHP &gt;=7.1.3

1.0.8PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/a51ea3b6c09e37e3ddc959f064a0be050ac2644370028326fb0d11eaac0a1ce4?d=identicon)[giedriusgrusokasvdu](/maintainers/giedriusgrusokasvdu)

---

Top Contributors

[![martynaszaliaduonis](https://avatars.githubusercontent.com/u/43949022?v=4)](https://github.com/martynaszaliaduonis "martynaszaliaduonis (24 commits)")[![zefy](https://avatars.githubusercontent.com/u/5538557?v=4)](https://github.com/zefy "zefy (12 commits)")[![vduit](https://avatars.githubusercontent.com/u/46518235?v=4)](https://github.com/vduit "vduit (5 commits)")

---

Tags

laravelAuthenticationSSOlogin

### Embed Badge

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

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

###  Alternatives

[zefy/laravel-sso

Simple PHP SSO integration for Laravel

1033.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)
