PHPackages                             sngular/sngulauth - 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. sngular/sngulauth

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

sngular/sngulauth
=================

Auth package against Keycloak for Saml and Openid-Connect

1.5(5y ago)02.8kMITPHPCI failing

Since Aug 2Pushed 5y ago1 watchersCompare

[ Source](https://github.com/manuel-garcia-sn/sngulauth)[ Packagist](https://packagist.org/packages/sngular/sngulauth)[ Docs](https://www.sngular.com/)[ RSS](/packages/sngular-sngulauth/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (5)Versions (15)Used By (0)

This is the ultimate package for manage Keycloak authentication with Openid Connect
===================================================================================

[](#this-is-the-ultimate-package-for-manage-keycloak-authentication-with-openid-connect)

### Before start, you need some parameters

[](#before-start-you-need-some-parameters)

- **authServerUrl**: keycloak auth url
- **realm**: realm name that has been set up for the project
- **clientId**: client id name that has been set up for the project
- **clientSecret**: client secret name that has been set up for the project
- **redirectUri**: the redirect url to be redirected after successful credentials prompt (this url must be valid on keycloak client configuration)
- **encryptionAlgorithm**: algorithm to decode the JWT information, default is RS256
- **encryptionKeyString**: the public key content in one line (without BEGIN PUBLIC KEY and END PUBLIC KEY) in order to decrypt the JWT and get the user info.

### The auth process

[](#the-auth-process)

The src/Provider/Keycloak/Protocol/Connect class needs an array to be instantiated with those parameters:

```
$auth = new Connect($config);

```

Then you can build the auth url to redirect user or display a link:

```
$authUrl = $auth->getAuthorizationUrl();

```

After user insert his credentials on Keycloak login page, it will be redirected to **redirectUri** parameter, with a code. Now you can fetch a token (League\\OAuth2\\Client\\Token\\AccessToken) against keycloak with those code:

```
$token = $auth->authByCode($_GET['code']);
```

Now you can get the resource owner (the user data) against keycloak

```
$user = $auth->getResourceOwner($token);

```

And decrypt the token to get the token payload:

```
$userData = $auth->decryptResponse($token->getToken());

```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 80% 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 ~32 days

Recently: every ~54 days

Total

14

Last Release

2049d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3dfe98c03abfec531bfdd7bd60d3e55b05e46d4bd45f79824e8696e6cd52638f?d=identicon)[manuel-garcia-sn](/maintainers/manuel-garcia-sn)

---

Top Contributors

[![manuel-garcia-sn](https://avatars.githubusercontent.com/u/52311652?v=4)](https://github.com/manuel-garcia-sn "manuel-garcia-sn (12 commits)")[![mjgr0013](https://avatars.githubusercontent.com/u/8981247?v=4)](https://github.com/mjgr0013 "mjgr0013 (2 commits)")[![subsider](https://avatars.githubusercontent.com/u/6003993?v=4)](https://github.com/subsider "subsider (1 commits)")

---

Tags

authsamlconnectkeycloakoneloginsngular

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sngular-sngulauth/health.svg)

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

###  Alternatives

[stevenmaguire/oauth2-keycloak

Keycloak OAuth 2.0 Client Provider for The PHP League OAuth2-Client

2275.9M27](/packages/stevenmaguire-oauth2-keycloak)[aacotroneo/laravel-saml2

A Laravel package for Saml2 integration as a SP (service provider) for multiple IdPs, based on OneLogin toolkit which is much more lightweight than simplesamlphp.

5704.4M](/packages/aacotroneo-laravel-saml2)[robsontenorio/laravel-keycloak-guard

🔑 Simple Keycloak Guard for Laravel

5161.1M3](/packages/robsontenorio-laravel-keycloak-guard)[ellaisys/aws-cognito

AWS Cognito package that allows Auth and other related features using the AWS SDK for PHP

120220.7k1](/packages/ellaisys-aws-cognito)[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).

263763.5k1](/packages/codegreencreative-laravel-samlidp)

PHPackages © 2026

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