PHPackages                             stellarbit/saml2 - 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. stellarbit/saml2

ActiveLibrary

stellarbit/saml2
================

SAML2 PHP library from SimpleSAMLphp

3.4.4(3y ago)031LGPL-2.1-or-laterPHPPHP &gt;=5.4

Since Nov 8Pushed 3y ago2 watchersCompare

[ Source](https://github.com/stellarbit/saml2)[ Packagist](https://packagist.org/packages/stellarbit/saml2)[ RSS](/packages/stellarbit-saml2/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (10)Versions (2)Used By (1)

SimpleSAMLphp SAML2 library
===========================

[](#simplesamlphp-saml2-library)

[![Build Status](https://camo.githubusercontent.com/cb5374bb886a563b96090e90423a4e5dd1f5a060f4c00baf776edee12b82fd8c/68747470733a2f2f7472617669732d63692e6f72672f73696d706c6573616d6c7068702f73616d6c322e706e673f6272616e63683d666561747572652f6669782d6275696c64)](https://travis-ci.org/simplesamlphp/saml2) [![Coverage Status](https://camo.githubusercontent.com/65abf5f264d57455f0b1cbf389e13a9dd34fc77c690e59430e8f30e230f9086a/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f73696d706c6573616d6c7068702f73616d6c322e737667)](https://coveralls.io/r/simplesamlphp/saml2)

A PHP library for SAML2 related functionality. Extracted from [SimpleSAMLphp](https://www.simplesamlphp.org), used by [OpenConext](https://www.openconext.org). This library started as a collaboration between [UNINETT](https://www.uninett.no) and [SURFnet](https://www.surfnet.nl) but everyone is invited to contribute.

Before you use it
-----------------

[](#before-you-use-it)

**DO NOT USE THIS LIBRARY UNLESS YOU ARE INTIMATELY FAMILIAR WITH THE SAML2 SPECIFICATION.**

If you are not familiar with the SAML2 specification and are simply looking to connect your application using SAML2, you should probably use [SimpleSAMLphp](https://www.simplesamlphp.org).

Note that the **HTTP Artifact Binding and SOAP client do not work** outside of SimpleSAMLphp.

Which version to pick?
----------------------

[](#which-version-to-pick)

The latest released version (`3.x` range) is the *only supported version*.

All other branches (`2.x` and earlier) are no longer supported and will not receive any maintenance or (security) fixes. Do not use these versions.

Usage
-----

[](#usage)

- Install with [Composer](https://getcomposer.org/doc/00-intro.md), run the following command in your project:

```
composer require simplesamlphp/saml2:^3.0
```

- Provide the required external dependencies by extending and implementing the `SAML2\Compat\AbstractContainer`then injecting it in the ContainerSingleton (see example below).
- **Make sure you've read the security section below**.
- Use at will. Example:

```
    // Use Composers autoloading
    require 'vendor/autoload.php';

    // Implement the Container interface (out of scope for example)
    require 'container.php';
    SAML2\Compat\ContainerSingleton::setContainer($container);

    // Set up an AuthnRequest
    $request = new SAML2\AuthnRequest();
    $request->setId($container->generateId());
    $request->setIssuer('https://sp.example.edu');
    $request->setDestination('https://idp.example.edu');

    // Send it off using the HTTP-Redirect binding
    $binding = new SAML2\HTTPRedirect();
    $binding->send($request);
```

Security
--------

[](#security)

- Should you need to create a DOMDocument instance, use the `SAML2\DOMDocumentFactory` to create DOMDocuments from either a string (`SAML2\DOMDocumentFactory::fromString($theXmlAsString)`), a file (`SAML2\DOMDocumentFactory::fromFile($pathToTheFile)`) or just a new instance (`SAML2\DOMDocumentFactory::create()`). This in order to protect yourself against the [XXE Processing Vulnerability](https://www.owasp.org/index.php/XML_External_Entity_(XXE)_Processing), as well as [XML Entity Expansion](https://phpsecurity.readthedocs.org/en/latest/Injection-Attacks.html#defenses-against-xml-entity-expansion) attacks

License
-------

[](#license)

This library is licensed under the LGPL license version 2.1. For more details see [LICENSE](https://raw.github.com/simplesamlphp/saml2/master/LICENSE).

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

1287d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a881cea8e4820ae067cd4d454854b04ab111c9f56f5bf05adb0cd03713591a4c?d=identicon)[Marat555](/maintainers/Marat555)

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/stellarbit-saml2/health.svg)

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

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[infection/infection

Infection is a Mutation Testing framework for PHP. The mutation adequacy score can be used to measure the effectiveness of a test set in terms of its ability to detect faults.

2.2k26.2M1.8k](/packages/infection-infection)[danog/madelineproto

Async PHP client API for the telegram MTProto protocol.

3.4k855.0k18](/packages/danog-madelineproto)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[humbug/box

Fast, zero config application bundler with PHARs.

1.3k801.5k69](/packages/humbug-box)[jeroen-g/explorer

Next-gen Elasticsearch driver for Laravel Scout.

397612.3k](/packages/jeroen-g-explorer)

PHPackages © 2026

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