# Connecting with PHP This guide explains how to establish a connection between a PHP application and a Keycloak identity provider using the jumbojett/openid-connect-php library. It walks through the necessary setup, configuration, and execution of a protected login route using OpenID Connect (OIDC). ## **Variables** Certain parameters must be provided to integrate a PHP application with Keycloak. Below is a breakdown of each required variable, its purpose, and where to find it. Here’s what each variable represents:
**Variable** | **Description** | **Purpose** |
---|---|---|
`CLIENT_ID` | Client ID from the Keycloak Admin Console | Identifies the PHP app in the Keycloak realm |
`CLIENT_SECRET` | Secret from the Client > Credentials tab | Authenticates the PHP app with Keycloak |
`ISSUER` | The Keycloak realm URL (e.g., https://your-domain/realms/your-realm) | Acts as the OIDC issuer and discovery endpoint |
`REDIRECT_URI` | The URI that Keycloak will redirect to after login | Where the user will be sent after successful authentication |
`TOKEN_ENDPOINT` | Token URL under the selected realm | Used to retrieve access/ID tokens |
`USERINFO_ENDPOINT` | URL to fetch user profile information | Used to retrieve authenticated user details |