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.7(2mo ago)1313MITPHP

Since Nov 12Pushed 2mo ago1 watchersCompare

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

READMEChangelogDependencies (4)Versions (14)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

40

—

FairBetter than 86% of packages

Maintenance83

Actively maintained with recent releases

Popularity16

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 ~42 days

Recently: every ~123 days

Total

13

Last Release

89d 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

[backpack/crud

Quickly build admin interfaces using Laravel, Bootstrap and JavaScript.

3.4k3.7M223](/packages/backpack-crud)[statamic/cms

The Statamic CMS Core Package

4.8k3.6M985](/packages/statamic-cms)[unopim/unopim

UnoPim Laravel PIM

10.5k2.4k](/packages/unopim-unopim)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)

PHPackages © 2026

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