PHPackages                             zitadel/client - 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. zitadel/client

ActiveLibrary[API Development](/categories/api)

zitadel/client
==============

Official Zitadel SDK for PHP. Authenticate and access Zitadel's authentication and management APIs in PHP.

4.1.0(2mo ago)515.8k—0.2%2[3 PRs](https://github.com/zitadel/client-php/pulls)Apache-2.0PHPPHP ^8.3CI passing

Since Apr 2Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/zitadel/client-php)[ Packagist](https://packagist.org/packages/zitadel/client)[ Docs](https://github.com/zitadel/client-php)[ RSS](/packages/zitadel-client/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (28)Versions (54)Used By (0)

PHP SDK for Zitadel
===================

[](#php-sdk-for-zitadel)

This is the Zitadel PHP SDK, designed to provide a convenient and idiomatic way to interact with the Zitadel APIs in PHP. The SDK provides a seamless wrapping of the Zitadel API, making it easy to authenticate service users and perform API operations.

The SDK enables efficient integration with the Zitadel API, allowing you to manage resources and execute actions. However, it's important to note that this SDK is tailored for service users and is not intended for user authentication scenarios. It does not support authentication mechanisms like OAuth2, OIDC, or SAML for client applications, including web, mobile, or other environments. For these types of user authentication, you should use other libraries that are designed for the specific platform and authentication method.

**Disclaimer**: This SDK is not suitable for implementing user authentication. It does not handle authentication for client applications using OAuth2, OIDC, or SAML and should not be used for scenarios requiring such functionality. For those use cases, consider using other solutions that are designed for user authentication across various platforms like web, mobile, or other client environments.

Important

Please be aware that this SDK is currently in an incubating stage. We are releasing it to the community to gather feedback and learn how it is being used. While you are welcome to use it, please note that the API and functionality may evolve based on community input. We encourage you to try it out and share your experiences, but advise caution when considering it for production environments as future updates may introduce changes.

Getting Started
---------------

[](#getting-started)

### Sign up for Zitadel

[](#sign-up-for-zitadel)

To use this SDK, you need a Zitadel account. Sign up at the official Zitadel website and obtain the necessary credentials to access the API.

### Minimum Requirements

[](#minimum-requirements)

Ensure you have PHP 8.0 or higher installed. You also need Composer to install dependencies.

Using the SDK
-------------

[](#using-the-sdk)

### Installation

[](#installation)

Install the SDK by running one of the following commands:

```
composer require zitadel/client
```

Authentication Methods
----------------------

[](#authentication-methods)

Your SDK offers three ways to authenticate with Zitadel. Each method has its own benefits—choose the one that fits your situation best.

#### 1. Private Key JWT Authentication

[](#1-private-key-jwt-authentication)

**What is it?**You use a JSON Web Token (JWT) that you sign with a private key stored in a JSON file. This process creates a secure token.

**When should you use it?**

- **Best for production:** It offers strong security.
- **Advanced control:** You can adjust token settings like expiration.

**How do you use it?**

1. Save your private key in a JSON file.
2. Use the provided method to load this key and create a JWT-based authenticator.

**Example:**

```
use Zitadel\Client\Zitadel;

$zitadel = Zitadel::withPrivateKey("https://example.us1.zitadel.cloud", "path/to/jwt-key.json");

try {
    $response = $zitadel->users->addHumanUser((new UserServiceAddHumanUserRequest())
        ->setUsername('john.doe')
        ->setProfile(
            (new UserServiceSetHumanProfile())
                ->setGivenName('John')
                ->setFamilyName('Doe')
        )
        ->setEmail(
            (new UserServiceSetHumanEmail())
                ->setEmail('john@doe.com')
        ));
    echo "User created: " . print_r($response, true);
} catch (ApiException $e) {
    echo "Error: " . $e->getMessage();
}
```

#### 2. Client Credentials Grant

[](#2-client-credentials-grant)

**What is it?**This method uses a client ID and client secret to get a secure access token, which is then used to authenticate.

**When should you use it?**

- **Simple and straightforward:** Good for server-to-server communication.
- **Trusted environments:** Use it when both servers are owned or trusted.

**How do you use it?**

1. Provide your client ID and client secret.
2. Build the authenticator

**Example:**

```
use Zitadel\Client\Zitadel;
use Zitadel\Client\Model\UserServiceAddHumanUserRequest;
use Zitadel\Client\Model\UserServiceSetHumanProfile;
use Zitadel\Client\Model\UserServiceSetHumanEmail;

$zitadel = Zitadel::withClientCredentials("https://example.us1.zitadel.cloud", "id", "secret");

try {
    $response = $zitadel->users->addHumanUser((new UserServiceAddHumanUserRequest())
        ->setUsername('john.doe')
        ->setProfile(
            (new UserServiceSetHumanProfile())
                ->setGivenName('John')
                ->setFamilyName('Doe')
        )
        ->setEmail(
            (new UserServiceSetHumanEmail())
                ->setEmail('john@doe.com')
        ));
    echo "User created: " . print_r($response, true);
} catch (ApiException $e) {
    echo "Error: " . $e->getMessage();
}
```

#### 3. Personal Access Tokens (PATs)

[](#3-personal-access-tokens-pats)

**What is it?**A Personal Access Token (PAT) is a pre-generated token that you can use to authenticate without exchanging credentials every time.

**When should you use it?**

- **Easy to use:** Great for development or testing scenarios.
- **Quick setup:** No need for dynamic token generation.

**How do you use it?**

1. Obtain a valid personal access token from your account.
2. Create the authenticator with: `PersonalAccessTokenAuthenticator`

**Example:**

```
use Zitadel\Client\Zitadel;
use Zitadel\Client\Model\UserServiceAddHumanUserRequest;
use Zitadel\Client\Model\UserServiceSetHumanProfile;
use Zitadel\Client\Model\UserServiceSetHumanEmail;

$zitadel = Zitadel::withAccessToken("https://example.us1.zitadel.cloud", "token");

try {
    $response = $zitadel->users->addHumanUser(
        (new UserServiceAddHumanUserRequest())
            ->setUsername('john.doe')
            ->setProfile(
                (new UserServiceSetHumanProfile())
                    ->setGivenName('John')
                    ->setFamilyName('Doe')
            )
            ->setEmail(
                (new UserServiceSetHumanEmail())
                    ->setEmail('john@doe.com')
            )
    );
    echo "User created: " . print_r($response, true);
} catch (ApiException $e) {
    echo "Error: " . $e->getMessage();
}
```

---

Choose the authentication method that best suits your needs based on your environment and security requirements. For more details, please refer to the [Zitadel documentation on authenticating service users](https://zitadel.com/docs/guides/integrate/service-users/authenticate-service-users).

Advanced Configuration
----------------------

[](#advanced-configuration)

The SDK provides a `TransportOptions` object that allows you to customise the underlying HTTP transport used for both OpenID discovery and API calls.

### Disabling TLS Verification

[](#disabling-tls-verification)

In development or testing environments with self-signed certificates, you can disable TLS verification entirely:

```
use Zitadel\Client\Zitadel;
use Zitadel\Client\TransportOptions;

$options = new TransportOptions(insecure: true);

$zitadel = Zitadel::withClientCredentials(
    'https://your-instance.zitadel.cloud',
    'client-id',
    'client-secret',
    $options,
);
```

### Using a Custom CA Certificate

[](#using-a-custom-ca-certificate)

If your Zitadel instance uses a certificate signed by a private CA, you can provide the path to the CA certificate in PEM format:

```
use Zitadel\Client\Zitadel;
use Zitadel\Client\TransportOptions;

$options = new TransportOptions(caCertPath: '/path/to/ca.pem');

$zitadel = Zitadel::withClientCredentials(
    'https://your-instance.zitadel.cloud',
    'client-id',
    'client-secret',
    $options,
);
```

### Custom Default Headers

[](#custom-default-headers)

You can attach default headers to every outgoing request. This is useful for custom routing or tracing headers:

```
use Zitadel\Client\Zitadel;
use Zitadel\Client\TransportOptions;

$options = new TransportOptions(
    defaultHeaders: ['X-Custom-Header' => 'my-value'],
);

$zitadel = Zitadel::withClientCredentials(
    'https://your-instance.zitadel.cloud',
    'client-id',
    'client-secret',
    $options,
);
```

### Proxy Configuration

[](#proxy-configuration)

If your environment requires routing traffic through an HTTP proxy, you can specify the proxy URL. To authenticate with the proxy, embed the credentials directly in the URL:

```
use Zitadel\Client\Zitadel;
use Zitadel\Client\TransportOptions;

$options = new TransportOptions(proxyUrl: 'http://user:pass@proxy:8080');

$zitadel = Zitadel::withClientCredentials(
    'https://your-instance.zitadel.cloud',
    'client-id',
    'client-secret',
    $options,
);
```

Design and Dependencies
-----------------------

[](#design-and-dependencies)

This SDK is designed to be lean and efficient, focusing on providing a streamlined way to interact with the Zitadel API. It relies on Guzzle's PSR-7 compliant HTTP transport for making requests, which ensures that the SDK integrates well with other libraries and provides flexibility in terms of request handling and error management.

Versioning
----------

[](#versioning)

A key aspect of our strategy is that the SDK's major version is synchronized with the ZITADEL core project's major version to ensure compatibility. For a detailed explanation of this policy and our release schedule, please see our [Versioning Guide](VERSIONING.md).

Contributing
------------

[](#contributing)

This repository is autogenerated. We do not accept direct contributions. Instead, please open an issue for any bugs or feature requests.

Reporting Issues
----------------

[](#reporting-issues)

If you encounter any issues or have suggestions for improvements, please open an issue in the [issue tracker](https://github.com/zitadel/client-php/issues). When reporting an issue, please provide the following information to help us address it more effectively:

- A detailed description of the problem or feature request
- Steps to reproduce the issue (if applicable)
- Any relevant error messages or logs
- Environment details (e.g., OS version, relevant configurations)

Support
-------

[](#support)

If you need help setting up or configuring the SDK (or anything Zitadel), please head over to the [Zitadel Community on Discord](https://zitadel.com/chat).

There are many helpful people in our Discord community who are ready to assist you.

Cloud and enterprise customers can additionally reach us privately via our [support communication channels](https://zitadel.com/docs/legal/service-description/support-services).

License
-------

[](#license)

This SDK is distributed under the Apache 2.0 License.

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance88

Actively maintained with recent releases

Popularity34

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 85% 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 ~15 days

Recently: every ~45 days

Total

21

Last Release

62d ago

Major Versions

1.10.0 → 4.1.0-beta.12025-07-09

PHP version history (3 changes)1.4.0PHP ^8.0

4.1.0-beta.1PHP ^8.

4.1.0-beta.8PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/c2761c3265ad185bce9ca09b7b2fc039e14952ba776597fdfa8bf5d6f0c8e418?d=identicon)[zitadel](/maintainers/zitadel)

---

Top Contributors

[![mridang](https://avatars.githubusercontent.com/u/327432?v=4)](https://github.com/mridang "mridang (187 commits)")[![semantic-release-bot](https://avatars.githubusercontent.com/u/32174276?v=4)](https://github.com/semantic-release-bot "semantic-release-bot (28 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")

---

Tags

client-libclient-libraryiamsdksdk-phpzitadelzitadel-sdkapiiamclient libraryzitadelclient-libsdk-pythonzitadel-sdk

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/zitadel-client/health.svg)

```
[![Health](https://phpackages.com/badges/zitadel-client/health.svg)](https://phpackages.com/packages/zitadel-client)
```

###  Alternatives

[saloonphp/saloon

Build beautiful API integrations and SDKs with Saloon

2.4k9.6M468](/packages/saloonphp-saloon)[kreait/firebase-php

Firebase Admin SDK

2.4k39.7M72](/packages/kreait-firebase-php)[hubspot/api-client

Hubspot API client

23914.2M16](/packages/hubspot-api-client)[theodo-group/llphant

LLPhant is a library to help you build Generative AI applications.

1.5k311.5k5](/packages/theodo-group-llphant)[php-opencloud/openstack

PHP SDK for OpenStack APIs. Supports BlockStorage, Compute, Identity, Images, Networking and Metric Gnocchi

2292.2M24](/packages/php-opencloud-openstack)[xeroapi/xero-php-oauth2

Xero official PHP SDK for oAuth2 generated with OpenAPI spec 3

1054.3M14](/packages/xeroapi-xero-php-oauth2)

PHPackages © 2026

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