php-sso / saml
SAML 2.0 for PHP applications. Sign people in through a company's identity provider (service provider role); the application's connections and request storage sit behind interfaces you implement.
Requires
- php: ^8.2
- ext-dom: *
- ext-mbstring: *
- ext-openssl: *
- onelogin/php-saml: ^4.5
Requires (Dev)
- phpstan/phpstan: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-strict-rules: ^2.0
- phpunit/phpunit: ^11.0 || ^12.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-22 00:31:39 UTC
README
SAML 2.0 for PHP applications. Today it covers one role, the service provider: people sign in to your application
through their company's identity provider (Okta, Entra, ADFS, Keycloak and others). The identity provider role (your
application vouching for people at another SSO instance) is not built; it would live next to this one in
PhpSso\Saml\IdentityProvider, sharing the SAML plumbing.
- The XML and signature work is done by
onelogin/php-saml, never by hand-written XML signature code. This package decides what to ask of it and what to trust. - No framework and no HTTP layer: you pass in the posted
SAMLResponseand the browser's cookie and get an identity back. Your connections and your request storage are interfaces you implement.
Install
composer require php-sso/saml
PHP 8.2 or newer, with ext-dom, ext-mbstring and ext-openssl.
Documentation
The documentation is at https://php-sso.github.io/saml/:
- What it decides: what the library checks, and what it refuses
- What you provide: the interfaces your application implements
- Wiring: putting it together
The pages are in docs/content, built with Hugo and the
php-sso docs theme. Preview them with hugo server --source docs.
Development
composer install
composer check # phpstan, then phpunit
The tests build real signed answers with a fake identity provider (tests/support/IdpFixture.php) and run SignIn against
in-memory implementations of both interfaces.
License
MIT. See LICENSE.