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

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

agriserv/sso
============

A package to integrate with Agriserv SSO.

v1.1.6-stable(1y ago)1149MITPHP

Since Nov 12Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Mamdouh95/ag-sso)[ Packagist](https://packagist.org/packages/agriserv/sso)[ RSS](/packages/agriserv-sso/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (13)Used By (0)

AgriServ SSO
============

[](#agriserv-sso)

Easily integrate your application with **AgriServ SSO**.

---

Installation Steps
------------------

[](#installation-steps)

### 1. Install the Package

[](#1-install-the-package)

Add the package to your Laravel application via Composer:

```
composer require agriserv/sso
```

### 2. Publish the Configuration and Controller

[](#2-publish-the-configuration-and-controller)

```
php artisan vendor:publish --provider="Agriserv\SSO\AgriservSsoServiceProvider" --tag="config"
```

This will create a config/sso.php file in your application.

```
php artisan vendor:publish --provider="Agriserv\SSO\AgriservSsoServiceProvider" --tag="sso-controller"
```

This will publish a controller to your application at: app/Http/Controllers/LoginSsoController.php.

### 3. Set Up an Application in AgriServ SSO

[](#3-set-up-an-application-in-agriserv-sso)

Ask the AgriServ SSO Administrator to generate an application for you. Provide them with the following details: CALL\_BACK\_URI: Your application's callback URL.

### 4. Configure the .env File

[](#4-configure-the-env-file)

Add the following variables to your .env file:

```
SSO_BASE_URI="https://sso.agriserv.sa"
SSO_ID="APP_ID" # Replace with the Application ID provided by AgriServ Admin
SSO_SECRET_KEY="SECRET_KEY" # Replace with the Secret Key provided by AgriServ Admin
SSO_REDIRECT_URI="CALL_BACK_URI" # Replace with your callback URL
```

### 5. Override the handleUserInfo Method

[](#5-override-the-handleuserinfo-method)

Once the LoginSsoController is published, you can override the handleUserInfo method to handle the logic for processing user data from SSO.

Example: Handling User Info Open the `app/Http/Controllers/LoginSsoController.php` file, and modify the `handleUserInfo` method as needed:

```
 $userData['sso_id'] ?? $userInfo['id'],
        ], $userData);

        // Dynamically assign roles
        $this->syncUserRoles($user, $userInfo['roles']);

        // Log the user in
        Auth::login($user);

        // Redirect after login
        return redirect()->to(session('previousUrl') ?? '/');
    }

    /**
     * Sync roles with the local user.
     */
    private function syncUserRoles($user, array $roles)
    {
        if (method_exists($user, 'syncRoles')) {
            try {
                $user->syncRoles($roles);
            } catch (\Exception|\Throwable $e) {
                Log::warning("Failed to sync roles: " . $e->getMessage());
            }
        }
    }
}
```

### 6. Test Your Integration

[](#6-test-your-integration)

Test your SSO integration by navigating to the SSO login route (e.g., `/auth/sso`). Ensure users are logged in and synchronized correctly with your application.

### 7. Add Middleware for the protected routes

[](#7-add-middleware-for-the-protected-routes)

```
Route::middleware('sso_auth')->group(function () {
// Add routes
}

```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance44

Moderate activity, may be stable

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

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.

###  Release Activity

Cadence

Every ~10 days

Recently: every ~25 days

Total

12

Last Release

439d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/235bc6542e9b444197dc96c8a60cb6597681ff1fd9712ca7d94399bd9fdfd36d?d=identicon)[Mamdouh95](/maintainers/Mamdouh95)

---

Top Contributors

[![Mamdouh95](https://avatars.githubusercontent.com/u/13463428?v=4)](https://github.com/Mamdouh95 "Mamdouh95 (1 commits)")

### Embed Badge

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

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

###  Alternatives

[lab404/laravel-impersonate

Laravel Impersonate is a plugin that allows to you to authenticate as your users.

2.3k16.4M48](/packages/lab404-laravel-impersonate)[metrogistics/laravel-azure-ad-oauth

Provides single-sign-on ability to Microsoft Azure Active Directory enabled apps.

8679.1k1](/packages/metrogistics-laravel-azure-ad-oauth)[truckersmp/steam-socialite

Laravel Socialite provider for Steam OpenID.

1516.7k](/packages/truckersmp-steam-socialite)

PHPackages © 2026

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