PHPackages                             programster/saml - 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. programster/saml

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

programster/saml
================

A library to help with interfacing with a SAML SSO. This does so by wrapping around the onelogin/php-saml package.

2.3.1(4y ago)1212MITPHPPHP &gt;=8.0.0

Since Aug 18Pushed 4y ago1 watchersCompare

[ Source](https://github.com/programster/package-saml-helper)[ Packagist](https://packagist.org/packages/programster/saml)[ Docs](https://github.com/programster/package-saml-helper)[ RSS](/packages/programster-saml/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (1)Versions (25)Used By (0)

SAML Helper
===========

[](#saml-helper)

A package to help with integrating with a SAML SSO.

Example Usage
-------------

[](#example-usage)

All of the examples require first creating the SAML "client" which has all of the settings. One must create it like so:

```
$spConfig = new Programster\Saml\ServiceProviderConfig(
    entityId: APP_SERVICE_PROVIDER_IDENTITY,
    name: APP_SERVICE_PROVIDER_NAME,
    description: "A test service provider",
    loginHandlerUrl: APP_URL . "/auth/saml-login-handler",
    logoutHandlerUrl: APP_URL . "/auth/saml-logout-handler",
    publicCert: file_get_contents(SERVICE_PROVIDER_CERT_PATH),
    privateKey: file_get_contents(SERVICE_PROVIDER_PRIVATE_KEY_PATH)
);

$idpConfig = new \Programster\Saml\IdentityProviderConfig(
    entityId: IDENTITY_PROVIDER_IDENTITY_URI,
    authUrl: IDENTITY_PROVIDER_AUTH_URL,
    logoutUrl: IDENTITY_PROVIDER_LOGOUT_URL,
    publicSigningCertificates: [file_get_contents(IDENTITY_PROVIDER_PUBLIC_SIGNING_CERT)],
);

$samlConfig = new \Programster\Saml\SamlConfig($spConfig, $idpConfig);
$samlClient = new \Programster\Saml\SamlClient($samlConfig);
```

I know that seems a bit long-winded, but the client requires a lot of settings to be configured, and I prefer this over expecting the developer to just pass in an array of key/value pairs and expecting them to know what keys they need to set etc.

Once you have the SAML client, you can use it for handling all the requests/responses like so:

Send the user with a signed SAML request to the SSO to log in and then get redirected back to our site with their information:

```
$returnToURL = "https://localhost/saml-login-handler";
$samlClient->handleUserLoginRequest($returnToURL);
```

Then use the client to handle the response from the SSO logging in and redirecting back to our site with the user's details:

```
$response = $samlClient->handleSamlLoginResponse();
$userAttributes = $response->getUserAttributes();
$userEmail = $userAttributes['email'][0];
```

Use the client to send a logout request to the SSO:

```
$returnToUrl = 'http://my.domain.com/auth/saml-logout-handler';
$samlClient->handleUserLogoutRequest($returnToUrl);
```

Handle the response from the SSO for that logout request:

```
$ssoLoggedOutUrl = $samlClient->handleSamlLogoutResponse();
```

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 91.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 ~13 days

Recently: every ~52 days

Total

22

Last Release

1508d ago

Major Versions

1.0.1 → 2.0.12021-08-20

1.1.0 → 2.1.12021-08-31

1.1.1 → 2.1.22021-09-23

1.2.0 → 2.2.02021-10-20

1.3.1 → 2.3.12022-05-18

PHP version history (2 changes)0.1.1PHP &gt;=8.0.0

1.0.1PHP &gt;=7.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/64a048ca8be761aced9419279975a21ef679b71c70d8263bc2fc413a87ad381c?d=identicon)[programster](/maintainers/programster)

---

Top Contributors

[![programster](https://avatars.githubusercontent.com/u/5709838?v=4)](https://github.com/programster "programster (54 commits)")[![j6montoya](https://avatars.githubusercontent.com/u/7832520?v=4)](https://github.com/j6montoya "j6montoya (5 commits)")

---

Tags

SSOsaml

### Embed Badge

![Health badge](/badges/programster-saml/health.svg)

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

###  Alternatives

[onelogin/php-saml

PHP SAML Toolkit

1.3k47.8M142](/packages/onelogin-php-saml)[scaler-tech/laravel-saml2

SAML2 Service Provider integration for Laravel applications, based on OneLogin toolkit

282109.9k](/packages/scaler-tech-laravel-saml2)[hslavich/oneloginsaml-bundle

OneLogin SAML Bundle for Symfony

1482.5M1](/packages/hslavich-oneloginsaml-bundle)[codegreencreative/laravel-samlidp

Make your PHP Laravel application an Identification Provider using SAML 2.0. This package allows you to implement your own Identification Provider (idP) using the SAML 2.0 standard to be used with supporting SAML 2.0 Service Providers (SP).

265842.7k1](/packages/codegreencreative-laravel-samlidp)[humanmade/wp-simple-saml

WordPress Simple SAML plugin

123305.2k5](/packages/humanmade-wp-simple-saml)[nbgrp/onelogin-saml-bundle

OneLogin SAML Symfony Bundle

551.4M](/packages/nbgrp-onelogin-saml-bundle)

PHPackages © 2026

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