PHPackages                             simplesamlphp/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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. simplesamlphp/saml2

ActiveSimplesamlphp-xmlprovider[Authentication &amp; Authorization](/categories/authentication)

simplesamlphp/saml2
===================

SAML2 PHP library from SimpleSAMLphp

v6.1.3(2mo ago)30317.2M—1.1%135[9 issues](https://github.com/simplesamlphp/saml2/issues)[1 PRs](https://github.com/simplesamlphp/saml2/pulls)20LGPL-2.1-or-laterPHPPHP ^8.3CI passing

Since Nov 5Pushed 1mo ago34 watchersCompare

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

READMEChangelog (10)Dependencies (22)Versions (206)Used By (20)Security (7)

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

[](#simplesamlphp-saml2-library)

[![CI](https://github.com/simplesamlphp/saml2/actions/workflows/php.yml/badge.svg)](https://github.com/simplesamlphp/saml2/actions/workflows/php.yml/badge.svg)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/a6bac1a9abb88d0f8e5f7506f1074c8e411e1ccb8889d6994666a90919fe3fa6/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f73696d706c6573616d6c7068702f73616d6c322f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/simplesamlphp/saml2/?branch=master)[![Coverage Status](https://camo.githubusercontent.com/593b0270a2f20e1de8a006c047360ba8f218b2f493d339e96a6d1f0417d28727/68747470733a2f2f636f6465636f762e696f2f67682f73696d706c6573616d6c7068702f73616d6c322f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/simplesamlphp/saml2)[![Type coverage](https://camo.githubusercontent.com/5da9da52b6f03f99aa323e6ed9c6ee385d3ee8638154d6e3d54be1cbbe451f50/68747470733a2f2f73686570686572642e6465762f6769746875622f73696d706c6573616d6c7068702f73616d6c322f636f7665726167652e737667)](https://shepherd.dev/github/simplesamlphp/saml2)[![Psalm Level](https://camo.githubusercontent.com/511aa8cafc1e8127f85b503a7649f73038a2c059f00cdacb8162c7e718b5229f/68747470733a2f2f73686570686572642e6465762f6769746875622f73696d706c6573616d6c7068702f73616d6c322f6c6576656c2e737667)](https://shepherd.dev/github/simplesamlphp/saml2)

A PHP library for SAML2 related functionality.

It is used by several products, most notably [SimpleSAMLphp](https://www.simplesamlphp.org) and [OpenConext](https://www.openconext.org).

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 (`4.x` range) is the *preferred version*. The `3.x branch` is our LTS branch and will be supported as long as supported releases of [SimpleSAMLphp](https://www.simplesamlphp.org) are using this branch.

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

We conform to [Semantic Versioning](https://semver.org/). Be sure to check the [UPGRADING.md](UPGRADING.md) file if you are upgrading from an older version. Here you will find instructions on how to deal with BC breaking changes between versions.

Usage
-----

[](#usage)

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

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

- Provide the required external dependencies by extending and implementing the `\SimpleSAML\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';
    \SimpleSAML\SAML2\Compat\ContainerSingleton::setContainer($container);

    // Create Issuer
    $issuer = new \SimpleSAML\SAML2\XML\saml\Issuer('https://sp.example.edu');

    // Instantiate SAML2 Random utils
    $randomUtils = new \SimpleSAML\SAML2\Utils\Random();

    // Set up an AuthnRequest
    $request = new \SimpleSAML\SAML2\XML\samlp\AuthnRequest(
        $issuer,
        $randomUtils->generateId(),
        null,
        'https://idp.example.edu'
    );

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

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

79

—

ExcellentBetter than 100% of packages

Maintenance87

Actively maintained with recent releases

Popularity68

Solid adoption and visibility

Community50

Growing community involvement

Maturity98

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~1 days

Total

188

Last Release

63d ago

Major Versions

v4.19.0 → v5.0.32025-09-09

v5.1.0-rc1 → v6.0.02025-11-20

v4.19.1 → v5.0.52025-12-08

v5.0.5 → v6.1.02026-02-19

v4.19.2 → v6.1.22026-03-14

PHP version history (9 changes)v0.1.0-alphaPHP &gt;=5.3.3

v3.1.0PHP &gt;=5.4

v3.4.0PHP &gt;=7.2

v4.1.8PHP &gt;=7.1

v4.2.2PHP &gt;=7.1 || ^8.0

v5.0.0-alpha.1PHP ^8.0

v5.0.0-alpha.14PHP ^8.1

v5.1.0-rc1PHP ^8.2

v6.1.0PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/501dd2b6f124d458fb362a1d4f783d971ccbacfb46294468ab3151b983093715?d=identicon)[joostd](/maintainers/joostd)

![](https://www.gravatar.com/avatar/579a16ea8afccc6ab420c393f0e573296fe46dcd293aa4f3b71eefc158ebf3e4?d=identicon)[jaime](/maintainers/jaime)

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

![](https://www.gravatar.com/avatar/9221e348303eeda74e85236a8bff9b919a90d10e3a478fe1cbb9d833f68d0150?d=identicon)[thijskh](/maintainers/thijskh)

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

---

Top Contributors

[![olavmrk](https://avatars.githubusercontent.com/u/349658?v=4)](https://github.com/olavmrk "olavmrk (1673 commits)")[![andreassolberg](https://avatars.githubusercontent.com/u/101361?v=4)](https://github.com/andreassolberg "andreassolberg (1099 commits)")[![tvdijen](https://avatars.githubusercontent.com/u/841045?v=4)](https://github.com/tvdijen "tvdijen (1042 commits)")[![jaimeperez](https://avatars.githubusercontent.com/u/1942728?v=4)](https://github.com/jaimeperez "jaimeperez (185 commits)")[![thijskh](https://avatars.githubusercontent.com/u/3808792?v=4)](https://github.com/thijskh "thijskh (150 commits)")[![lon](https://avatars.githubusercontent.com/u/462659?v=4)](https://github.com/lon "lon (36 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (22 commits)")[![soyunalavadora](https://avatars.githubusercontent.com/u/133754?v=4)](https://github.com/soyunalavadora "soyunalavadora (18 commits)")[![cb8](https://avatars.githubusercontent.com/u/10119913?v=4)](https://github.com/cb8 "cb8 (17 commits)")[![br00k](https://avatars.githubusercontent.com/u/2971381?v=4)](https://github.com/br00k "br00k (6 commits)")[![DRvanR](https://avatars.githubusercontent.com/u/1422284?v=4)](https://github.com/DRvanR "DRvanR (6 commits)")[![MKodde](https://avatars.githubusercontent.com/u/28252948?v=4)](https://github.com/MKodde "MKodde (6 commits)")[![trejjam](https://avatars.githubusercontent.com/u/3594540?v=4)](https://github.com/trejjam "trejjam (6 commits)")[![tbenr](https://avatars.githubusercontent.com/u/15999009?v=4)](https://github.com/tbenr "tbenr (5 commits)")[![olavmo-sikt](https://avatars.githubusercontent.com/u/98447575?v=4)](https://github.com/olavmo-sikt "olavmo-sikt (4 commits)")[![ghalse](https://avatars.githubusercontent.com/u/7996633?v=4)](https://github.com/ghalse "ghalse (4 commits)")[![bjorpe](https://avatars.githubusercontent.com/u/10811673?v=4)](https://github.com/bjorpe "bjorpe (4 commits)")[![jbaron-gingco](https://avatars.githubusercontent.com/u/18531461?v=4)](https://github.com/jbaron-gingco "jbaron-gingco (2 commits)")[![pradtke](https://avatars.githubusercontent.com/u/932934?v=4)](https://github.com/pradtke "pradtke (2 commits)")[![relaxnow](https://avatars.githubusercontent.com/u/524386?v=4)](https://github.com/relaxnow "relaxnow (2 commits)")

---

Tags

libraryphpsamlsaml2simplesamlphp

### Embed Badge

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

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

###  Alternatives

[simplesamlphp/simplesamlphp

A PHP implementation of a SAML 2.0 service provider and identity provider.

1.1k12.4M193](/packages/simplesamlphp-simplesamlphp)[google/auth

Google Auth Library for PHP

1.4k272.7M162](/packages/google-auth)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[web-auth/webauthn-lib

FIDO2/Webauthn Support For PHP

1225.3M72](/packages/web-auth-webauthn-lib)[web-auth/webauthn-framework

FIDO2/Webauthn library for PHP and Symfony Bundle.

50570.7k1](/packages/web-auth-webauthn-framework)[tempest/framework

The PHP framework that gets out of your way.

2.1k23.1k9](/packages/tempest-framework)

PHPackages © 2026

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