### Zitadel PHP Client 1.3.6 Help

# Basics

First, install the library via Composer:

composer require redstonepfalz/zitadel-php-client

Then, import the Composer autoload in your PHP project.

<?php require_once("vendor/autoload.php");

Before we import the required components, we have to create a settings array with the following information:

$settings = [ "domain" => "https://your-zitadel-instance.com", "serviceUserToken" => "Token of your service user", "userToken" => "User Token" ];

- Domain: The domain of your Zitadel instance without a slash at the end.

- serviceUserToken: The Token of a service User

### Create a service user

1. Go to the user tab of your Zitadel instance. Then, click on Machines and New.

2. Fill out the form and click "Create". IMPORTANT: Access Token Type has to be Bearer

3. Click on Actions and Generate Client Secret.

4. The displayed client secret is the service user token.

5. Now we have to grant the permissions to the service user. Go to the Organization-Tab and click this Plus-Button:

6. Select the service user from the list and check the permissions, the service user should have.

- userToken: The token of a user. The user token is only required for a few operations.

You must always pass the settings array as a parameter to a class when you initialize it. For example:

use ZitadelPhpClient\User\Create; $new_user = new Create($settings);
Last modified: 27 March 2024