PHPackages                             theodorejb/saml-utils - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. theodorejb/saml-utils

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

theodorejb/saml-utils
=====================

Utilities to streamline Light Saml usage

v2.1.0(3w ago)13.9k—8.9%MITPHPPHP &gt;=8.4CI passing

Since Apr 26Pushed 3w ago1 watchersCompare

[ Source](https://github.com/theodorejb/saml-utils)[ Packagist](https://packagist.org/packages/theodorejb/saml-utils)[ RSS](/packages/theodorejb-saml-utils/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (3)Dependencies (9)Versions (8)Used By (0)

SAML Utils
==========

[](#saml-utils)

This package provides a few helpful utilities on top of [Lite Saml](https://github.com/litesaml/lightsaml) to streamline common tasks.

Install via Composer
--------------------

[](#install-via-composer)

`composer require theodorejb/saml-utils`

Working with metadata
---------------------

[](#working-with-metadata)

The `SamlMetadata` class simplifies getting data from Identity Provider metadata. Call `SamlMetadata::fromXml($xml)` to create an instance from an Entity Descriptor XML string.

The underlying `EntityDescriptor` object can be accessed via a readonly `$entityDescriptor` property.

`SamlMetadata` implements the following methods:

### `getIdpCertificate()`

[](#getidpcertificate)

Returns an `X509Certificate` instance for the Identity Provider certificate.

### `getIdpSsoService()`

[](#getidpssoservice)

Returns the Redirect or POST `SingleSignOnService` defined by the Identity Provider for receiving a SAML request to initiate single sign-on.

### `getIdpLogoutService()`

[](#getidplogoutservice)

Returns the Redirect or POST `SingleLogoutService` defined by the Identity Provider.

Utility methods
---------------

[](#utility-methods)

The `SamlUtils` class implements the following static utility methods:

### `getRequestFromGlobals(): MessageContext`

[](#getrequestfromglobals-messagecontext)

Returns an object for the SAML request or response from the global GET/POST data.

### `getMessageHttpResponse(SamlMessage $message, string $bindingType): ResponseInterface`

[](#getmessagehttpresponsesamlmessage-message-string-bindingtype-responseinterface)

Returns a PSR-7 `Psr\Http\Message\ResponseInterface` instance for sending the SAML message.

### `sendResponse(ResponseInterface $response): void`

[](#sendresponseresponseinterface-response-void)

Emits a PSR-7 `Psr\Http\Message\ResponseInterface` to the client by sending its status line, headers, and body.

### `createSpMetadata(string $entityId, string $acsPostUrl, string $slsRedirectUrl, X509Certificate $certificate): string`

[](#createspmetadatastring-entityid-string-acsposturl-string-slsredirecturl-x509certificate-certificate-string)

Returns signed Service Provider metadata XML with an HTTP-POST assertion consumer service and HTTP-Redirect single logout service.

### `validateSignature(SamlMessage $message, X509Certificate $certificate): void`

[](#validatesignaturesamlmessage-message-x509certificate-certificate-void)

Throws an Exception if the message signature is missing or fails verification with the certificate.

### `getSubjectNameId(SamlResponse $response): string`

[](#getsubjectnameidsamlresponse-response-string)

Returns the user identity being asserted by the identity provider.

### `getFirstAttributeStatement(SamlResponse $response): AttributeStatement|null`

[](#getfirstattributestatementsamlresponse-response-attributestatementnull)

Returns the first assertion attribute statement if one exists.

### `getAttributeStatementValue(AttributeStatement $statement, string $name): string`

[](#getattributestatementvalueattributestatement-statement-string-name-string)

Returns the assertion attribute value for the specified attribute name. Throws an exception if the attribute doesn't exist.

### `getResponseAttributeValue(SamlResponse $response, string $name): string`

[](#getresponseattributevaluesamlresponse-response-string-name-string)

Same as `getAttributeStatementValue()`, but can be used directly from a `SamlResponse` rather than an `AttributeStatement`.

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance94

Actively maintained with recent releases

Popularity23

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity68

Established project with proven stability

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

Recently: every ~295 days

Total

7

Last Release

27d ago

Major Versions

v0.2.0 → v1.0.02023-04-26

v1.2.0 → v2.0.02026-07-06

PHP version history (2 changes)v0.1.0PHP &gt;=8.1

v2.0.0PHP &gt;=8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3053271?v=4)[Theodore Brown](/maintainers/theodorejb)[@theodorejb](https://github.com/theodorejb)

---

Top Contributors

[![theodorejb](https://avatars.githubusercontent.com/u/3053271?v=4)](https://github.com/theodorejb "theodorejb (19 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.2k555.0M2.8k](/packages/aws-aws-sdk-php)[guzzlehttp/guzzle

Guzzle is a PHP HTTP client library

23.5k1.1B37.6k](/packages/guzzlehttp-guzzle)[google/cloud-core

Google Cloud PHP shared dependency, providing functionality useful to all components.

346137.0M126](/packages/google-cloud-core)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

762297.9k53](/packages/civicrm-civicrm-core)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

353.6k](/packages/eslazarev-wildberries-sdk)[toin0u/geocoder-laravel

Geocoder Service Provider for Laravel

7515.5M20](/packages/toin0u-geocoder-laravel)

PHPackages © 2026

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