PHPackages                             pagewiser/keycloak-adapter - 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. pagewiser/keycloak-adapter

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

pagewiser/keycloak-adapter
==========================

Easy-to-use PHP adapter for Keycloak authentication

2.1.1(3mo ago)011MITPHPPHP &gt;= 7.2.0

Since Oct 2Pushed 3mo agoCompare

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

READMEChangelogDependencies (2)Versions (3)Used By (0)

Keycloak PHP adapter
====================

[](#keycloak-php-adapter)

[![Latest Stable Version](https://camo.githubusercontent.com/91b9281ac5d2d5e7d8ef253daf6d42cb95eb640887226dc2af6f33656ba2a7d5/68747470733a2f2f706f7365722e707567782e6f72672f6174616363616d612f6b6579636c6f616b2d616461707465722f762f737461626c65)](https://packagist.org/packages/ataccama/keycloak-adapter) [![Total Downloads](https://camo.githubusercontent.com/2e41cfbdea219d1865f1ba09441a782b95233610e35566fdb7cf72e98d59f192/68747470733a2f2f706f7365722e707567782e6f72672f6174616363616d612f6b6579636c6f616b2d616461707465722f646f776e6c6f616473)](https://packagist.org/packages/ataccama/keycloak-adapter) [![License](https://camo.githubusercontent.com/e55d22743cd4ed09578893b1ff5c497feebf55c302b845d27cb7920cd8d4fab0/68747470733a2f2f706f7365722e707567782e6f72672f6174616363616d612f6b6579636c6f616b2d616461707465722f6c6963656e7365)](https://packagist.org/packages/ataccama/keycloak-adapter) [![Monthly Downloads](https://camo.githubusercontent.com/91c429c6c3cca91f2f83fc8c33d5db2111c4c5959409d449f12d2dabe5056999/68747470733a2f2f706f7365722e707567782e6f72672f6174616363616d612f6b6579636c6f616b2d616461707465722f642f6d6f6e74686c79)](https://packagist.org/packages/ataccama/keycloak-adapter)

Install
-------

[](#install)

`composer require ataccama/keycloak-adapter`

Neon config:

```
parameters:
    keycloak:
        realmId: your_realm
        clientDd: your_client_id
        host: https://your.keycloak.com
        defaultRedirectUri: https://your.default.url
        api:
            username: your_username
            password: your_password
            clientId: your_api_client_id
            clientSecret: your_client_secret

services:
    - Ataccama\Adapters\Keycloak(%keycloak%)

```

Use
---

[](#use)

Create new class and extend class Ataccama\\Auth, then you MUST implement all missing methods with your own logic.

Login URL: `$loginUrl = $yourAuthClass->getLoginUrl()`

In code use your class like this: `$yourAuthClass->authorize($_GET['code'])`

Example (Nette Framework):

```
// waiting for authorization code from Keycloak
if ($yourAuthClass->authorize($this->getParameter('code'))) {
    $this->redirectUrl($yourAuthClass->getRedirectUri());
} else {
    if (!$yourAuthClass->isAuthorized()) {
        $this->redirectUrl($yourAuthClass->getLoginUrl());
    }
}

// check if user is logged in on every page, if not redirect him to Keycloak login page
if (!$yourAuthClass->isAuthorized()) {
    $this->redirectUrl($yourAuthClass->getLoginUrl());
}

```

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance88

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity31

Early-stage or recently created project

 Bus Factor1

Top contributor holds 72.7% 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 ~127 days

Total

2

Last Release

92d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/557fe3fb5c3fb03ff35111f8b8ca28f55293c4779a7c60c0f5135dd331370a02?d=identicon)[marten](/maintainers/marten)

---

Top Contributors

[![stolfam](https://avatars.githubusercontent.com/u/37073073?v=4)](https://github.com/stolfam "stolfam (64 commits)")[![martinjinda](https://avatars.githubusercontent.com/u/9948632?v=4)](https://github.com/martinjinda "martinjinda (16 commits)")[![marten-cz](https://avatars.githubusercontent.com/u/582397?v=4)](https://github.com/marten-cz "marten-cz (5 commits)")[![paclick](https://avatars.githubusercontent.com/u/3742226?v=4)](https://github.com/paclick "paclick (3 commits)")

### Embed Badge

![Health badge](/badges/pagewiser-keycloak-adapter/health.svg)

```
[![Health](https://phpackages.com/badges/pagewiser-keycloak-adapter/health.svg)](https://phpackages.com/packages/pagewiser-keycloak-adapter)
```

###  Alternatives

[nette/security

🔑 Nette Security: provides authentication, authorization and a role-based access control management via ACL (Access Control List)

3839.3M278](/packages/nette-security)[contributte/recaptcha

Google reCAPTCHA for Nette - Forms

421.3M4](/packages/contributte-recaptcha)[foglcz/ldap-authenticator

LDAP Authenticator plugin for Nette Framework

137.2k](/packages/foglcz-ldap-authenticator)

PHPackages © 2026

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