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

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

eighteen73/laravel-sso
======================

Abstract SSO logic into a reusable, self-contained Laravel package.

062PHPCI failing

Since Aug 8Pushed 1mo agoCompare

[ Source](https://github.com/eighteen73/laravel-sso)[ Packagist](https://packagist.org/packages/eighteen73/laravel-sso)[ RSS](/packages/eighteen73-laravel-sso/feed)WikiDiscussions main Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Eighteen73 SSO
==============

[](#eighteen73-sso)

A reusable Laravel package for integrating Single Sign-On (SSO) using Laravel Socialite, with built-in support for Zitadel and Filament.

**Note:** This is an opinionated, internal project designed primarily to meet the requirements of eighteen73. While it is open-sourced and feedback is welcome, its development is driven by our specific needs and workflows.

Features
--------

[](#features)

- Automatic Socialite provider registration for Zitadel.
- Dedicated `sso_accounts` table to map SSO identities to local users.
- Optional user model helpers for SSO account relationships and login policy checks.
- Configurable user resolution with opt-in auto-creation logic.
- Automatic integration with Filament login forms via render hooks.
- Support for multiple SSO connections per user.

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

[](#installation)

You can install the package via composer:

```
composer require eighteen73/laravel-sso
```

You should publish the migration and the config file with:

```
php artisan vendor:publish --tag="sso-config"
php artisan vendor:publish --tag="sso-migrations"
```

Run the migrations:

```
php artisan migrate
```

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

[](#configuration)

The configuration file is located at `config/sso.php`. You can customise the following:

- `provider`: The Socialite driver to use (defaulting to `zitadel`).
- `auto_create_users`: Whether to create a new local user if the SSO email is not found. This is disabled by default, so unknown SSO users are rejected unless you explicitly opt into provisioning.
- `redirect_path`: The path to redirect to after a successful login.
- `user_resolver`: The action class used to map SSO data to a local user.
- `filament`: Settings for Filament integration, including which panels to display the SSO button on.

Global Logout
-------------

[](#global-logout)

The package provides a `/sso/logout` route that not only logs the user out of your local Laravel application but also securely terminates their global SSO session at Zitadel (or the active provider). By default, the user will be redirected back to your application's home page after logging out of Zitadel.

To customise the return path, ensure you set the `ZITADEL_POST_LOGOUT_REDIRECT_URI` environment variable in your host application:

```
ZITADEL_POST_LOGOUT_REDIRECT_URI=https://your-app.com/logged-out
```

Customising User Resolution
---------------------------

[](#customising-user-resolution)

By default, the package links an SSO identity to an existing local user by matching the SSO email address. If no local user exists, login fails unless `auto_create_users` is explicitly enabled.

The built-in auto-creation path only fills common `name`, `email`, and `password` attributes. If your application requires additional columns such as `first_name`, `last_name`, `is_enabled`, `role`, tenant IDs, or any other app-specific state, create a custom action that implements `Eighteen73\SSO\Actions\ResolveUserContract` and update the `user_resolver` in your config.

You can also extend the default resolver if you only need to add behavior around the package's built-in linking logic:

```
namespace App\Actions;

use Eighteen73\SSO\Actions\ResolveUser;
use Laravel\Socialite\Contracts\User as ProviderUser;
use Illuminate\Contracts\Auth\Authenticatable;

class CustomResolveUser extends ResolveUser
{
    public function resolve(string $provider, ProviderUser $ssoUser): Authenticatable
    {
        $user = parent::resolve($provider, $ssoUser);

        // Add your custom logic here

        return $user;
    }
}
```

User Model Helpers
------------------

[](#user-model-helpers)

Your application user model can opt into SSO relationship and policy helpers by using the `HasSsoAccounts` trait:

```
namespace App\Models;

use Eighteen73\SSO\Concerns\HasSsoAccounts;
use Eighteen73\SSO\Contracts\HasSsoAccounts as HasSsoAccountsContract;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable implements HasSsoAccountsContract
{
    use HasSsoAccounts;

    public function requiresSsoLogin(): bool
    {
        return $this->role->requiresSso();
    }
}
```

The default policy methods are permissive: `requiresSsoLogin()` returns `false`, and `canUsePasswordLogin()` returns `true`. Override them in your application when roles, tenants, or other local rules require stricter behavior.

Testing
-------

[](#testing)

The package uses Pest for testing. You can run the tests with:

```
./vendor/bin/pest
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

23

—

LowBetter than 25% of packages

Maintenance61

Regular maintenance activity

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 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://avatars.githubusercontent.com/u/735284?v=4)[Ed Jeavons](/maintainers/edjeavons)[@edjeavons](https://github.com/edjeavons)

---

Top Contributors

[![edjeavons](https://avatars.githubusercontent.com/u/735284?v=4)](https://github.com/edjeavons "edjeavons (11 commits)")

### Embed Badge

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

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

###  Alternatives

[vitalybaev/laravel5-dkim

Laravel 5/6 package for signing outgoing messages with DKIM.

3163.1k](/packages/vitalybaev-laravel5-dkim)[firemultimedia/mautic-multi-captcha-bundle

This plugin brings Google's reCAPTCHA, hCaptcha, and Cloudflare Turnstile integration to mautic.

151.4k](/packages/firemultimedia-mautic-multi-captcha-bundle)

PHPackages © 2026

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