PHPackages                             felipe.devops/laravel-keycloak-admin - 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. [API Development](/categories/api)
4. /
5. felipe.devops/laravel-keycloak-admin

ActiveLibrary[API Development](/categories/api)

felipe.devops/laravel-keycloak-admin
====================================

Keycloak Admin Rest API for Laravel/Lumen

1.9(5y ago)011MITPHP

Since Jan 23Pushed 5y agoCompare

[ Source](https://github.com/felipedamacenoteodoro/laravel-keycloak-admin)[ Packagist](https://packagist.org/packages/felipe.devops/laravel-keycloak-admin)[ RSS](/packages/felipedevops-laravel-keycloak-admin/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (1)Versions (11)Used By (0)

### This is a forked repository from

[](#this-is-a-forked-repository-from-httpsgithubcommnikoeilaravel-keycloak-admin)

Original work credited to Mnikoei.

### Alternative

[](#alternative)

Keycloak Admin library made by Scito.

---

### Supports

[](#supports)

7. Laravel 8
8. Lumen 8
### Installation

[](#installation)

```
composer require haizad/laravel-keycloak-admin

```

### Copy the package config to your local config with the publish command:

[](#copy-the-package-config-to-your-local-config-with-the-publish-command)

#### Laravel only

[](#laravel-only)

```
php artisan vendor:publish --provider="LaravelKeycloakAdmin\KeycloakAdminServiceProvider"
```

#### Lumen only

[](#lumen-only)

Create a `config` folder in the root directory. Copy `keycloakAdmin.php` from `vendor/haizad/laravel-keycloak-admin/src/Config/`, and paste into `config` folder.

Register the provider in your boostrap app file `bootstrap/app.php`

Add the following line at that files. Please note that `$app->configure('keycloakAdmin');` should be placed below `$app->register(\LaravelKeycloakAdmin\KeycloakAdminServiceProvider::class);`.

```
//"Register Service Providers"  section
$app->register(\LaravelKeycloakAdmin\KeycloakAdminServiceProvider::class);
$app->configure('keycloakAdmin');

$app->router->group([
    'namespace' => 'App\Http\Controllers',
], function ($router) {
    require __DIR__.'/../routes/web.php';
});

return $app;
```

For facades, uncomment `$app->withFacades();` in your boostrap app file `bootstrap/app.php`

### Environment Setup

[](#environment-setup)

Add these environment variables to your .env :

```
KEYCLOAK_BASE_URL=http://keycloak-domain.example/auth

KEYCLOAK_REALM=

KEYCLOAK_REALM_PUBLIC_KEY=     # realm settings -> keys

KEYCLOAK_CLIENT_ID=

KEYCLOAK_CLIENT_SECRET=        # clients -> your_client -> credentials

KEYCLOAK_ADMIN_BASE_URL=${KEYCLOAK_BASE_URL}/admin/realms/${KEYCLOAK_REALM}

```

#### Enable realm managment

[](#enable-realm-managment)

Go to `clients -> your_client -> Service Account` then select realm-managment

from Client Roles list and assign realm-admin to client.

#### Available methods :

[](#available-methods-)

Package has provided services as below:

- user
- role
- client
- clientRole
- addon

Available functions:

- Create User
- Get All User
- Query User

All API's are declared in `config\keycloakAdmin.php`

### Usages

[](#usages)

Include the KeycloakAdmin inside your Laravel controller/API route

```
use LaravelKeycloakAdmin\Facades\KeycloakAdmin;

```

Example:

```
KeycloakAdmin::serviceName()->apiName($parameters)

//Create User Sample
//Refer https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_userrepresentation
KeycloakAdmin::user()->create([
                'body' => [
                        'username' => 'foo',
                        'enabled' => true,
                        'emailVerified' => false,
                        'email' => 'foo@email.com',
                        'credentials' => [[
                            'type' => 'password',
                            'value' => 'foobar',
                            'temporary' => false
                        ]]
                  ]
]);

//Query User Sample
//Refer Query parameter on GET /{realm}/users https://www.keycloak.org/docs-api/11.0/rest-api/index.html
KeycloakAdmin::user()->find([
            'query' => [
                 'email' => 'foobar@example.com'
            ]
]);

//Get All User Sample
KeycloakAdmin::user()->all();
```

### Additional Methods

[](#additional-methods)

#### Logout User session by user Id

[](#logout-user-session-by-user-id)

```
KeycloakAdmin::addon()->logoutById([
     'id' => 'user_id'
])

```

#### Set Expiry Access Token

[](#set-expiry-access-token)

```
KeycloakAdmin::addon()->setAccessTokenExpiry([
     'body' => [
             'accessTokenLifespan' => 60
       ]
])

```

### To do list

[](#to-do-list)

- Lumen Support
- Test LDAP Connection
- Import users from LDAP

All other api calls are same as examples just needs to provide required parameters as described in

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

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

Total

10

Last Release

1923d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ede989546f12f2a8ba1bf922694b5a70b02a07e49c138f9fc8986ff1940f3924?d=identicon)[felipe.devops](/maintainers/felipe.devops)

---

Top Contributors

[![Mnikoei](https://avatars.githubusercontent.com/u/19962633?v=4)](https://github.com/Mnikoei "Mnikoei (24 commits)")[![haizad](https://avatars.githubusercontent.com/u/23258127?v=4)](https://github.com/haizad "haizad (23 commits)")[![haizadvnet](https://avatars.githubusercontent.com/u/85096754?v=4)](https://github.com/haizadvnet "haizadvnet (22 commits)")[![felipedamacenoteodoro](https://avatars.githubusercontent.com/u/13315400?v=4)](https://github.com/felipedamacenoteodoro "felipedamacenoteodoro (2 commits)")

### Embed Badge

![Health badge](/badges/felipedevops-laravel-keycloak-admin/health.svg)

```
[![Health](https://phpackages.com/badges/felipedevops-laravel-keycloak-admin/health.svg)](https://phpackages.com/packages/felipedevops-laravel-keycloak-admin)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

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