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

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

eurechasherij/laravel-sso
=========================

Simple PHP SSO integration for Laravel

1.2.2(1y ago)13261MITPHPPHP &gt;=7.1.3

Since Mar 1Pushed 1y agoCompare

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

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

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

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

forked from [zefy\\laravelsso](https://github.com/zefy/laravel-sso)

[![](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 8+
- PHP 8.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 eurechasherij/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/eurechasherij/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}
```

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

```
SSO_SERVER_TYPE=
SSO_USERNAME_COLUMN=
```

### P.S. Server must be running on production mode to allow login using correct password (on another mode you can login using any password)

[](#ps-server-must-be-running-on-production-mode-to-allow-login-using-correct-password-on-another-mode-you-can-login-using-any-password)

---

### Broker

[](#broker)

Install this package using composer.

```
$ composer require eurechasherij/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 4 new options in your `.env` file:

```
SSO_SERVER_URL=
SSO_SERVER_TYPE=
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_SERVER_TYPE=broker
SSO_USERNAME_COLUMN=username
SSO_BROKER_NAME=site1
SSO_BROKER_SECRET=892asjdajsdksja74jh38kljk2929023
```

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 60% 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 ~122 days

Recently: every ~113 days

Total

21

Last Release

547d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3026f4726c51bfe018d400c4eba63e0575b02a08db8ba07f17eda51a9d52434b?d=identicon)[eurechasherij](/maintainers/eurechasherij)

---

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)")[![eurechasherij](https://avatars.githubusercontent.com/u/42608344?v=4)](https://github.com/eurechasherij "eurechasherij (4 commits)")

---

Tags

laravelAuthenticationSSOlogin

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/eurechasherij-laravel-sso/health.svg)](https://phpackages.com/packages/eurechasherij-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)
