PHP code example of alma-medical / keycloak-client
1. Go to this page and download the library: Download alma-medical/keycloak-client library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
alma-medical / keycloak-client example snippets
use Stevenmaguire\OAuth2\Client\Provider\Keycloak as KeycloakProvider;
$provider = new KeycloakProvider([
'authServerUrl' => 'https://my-keycloak.com/auth',
'clientId' => 'myClientId',
'clientSecret' => 'myCleintSecret',
'realm' => 'myRealm',
]);
use AlmaMedical\KeycloakClient\Keycloak;
$client = new Keycloak($provider);
$response = $client->callMethod('users');
use AlmaMedical\KeycloakClient\Method\GetUsers;
$getUsers = new GetUsers($client);
$users = $getUsers->call();
use AlmaMedical\KeycloakClient\Method\GetUser;
$getUsers = new GetUser($client, 'user_id');
$user = $getUsers->call();
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
$client->setCachePool(new FilesystemAdapter());
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.