oihana/php-zitadel

Composable PHP toolkit for the Zitadel identity provider. Bundles an OIDC/OAuth2 API client, JWT/JWKS verification, session lifecycle helpers backed by ArangoDB, OAuth client metadata resolution, V2 Action webhook catalog and descriptor, and Symfony Console commands.

Maintainers

Package info

github.com/BcommeBois/oihana-php-zitadel

pkg:composer/oihana/php-zitadel

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

dev-main 2026-05-25 19:45 UTC

This package is auto-updated.

Last update: 2026-05-25 19:45:48 UTC


README

Oihana PHP Zitadel

Composable PHP toolkit for the Zitadel identity provider. Part of the Oihana PHP ecosystem, this package bundles an OIDC/OAuth2 API client, JWT/JWKS verification, ArangoDB-backed session lifecycle helpers, OAuth client metadata resolution, V2 Action webhook catalog and descriptor, and Symfony Console commands.

Latest Version Total Downloads License

๐Ÿ“š Documentation

Full API reference (generated with phpDocumentor): https://bcommebois.github.io/oihana-php-zitadel

User guides (FR + EN) live under wiki/.

๐Ÿ“ฆ Installation

Requires PHP 8.4+ and a Zitadel instance reachable over HTTPS. Install via Composer:

composer require oihana/php-zitadel

โœจ What you can do

  • Talk to Zitadel over the Management + Auth APIs through ZitadelClient โ€” a Guzzle-based HTTP client composed of focused traits (ZitadelClientApplicationTrait, ZitadelClientPasswordTrait, ZitadelClientRoleTrait, ZitadelClientServiceTrait, ZitadelClientSessionTrait, ZitadelClientTargetTrait, ZitadelClientUserTrait), with typed enums for endpoints, scopes, grants, query methods, error ids and outcomes.
  • Resolve OAuth clients to human-readable names via OAuthClientResolver โ€” in-process TTL cache + ArangoDB oauth_clients mirror + fallback to the Zitadel Management API for auto-seeding.
  • Mirror Zitadel sessions in ArangoDB via SessionCreatorTrait โ€” upsert on [identifier, clientId, userAgent, active], sid anchoring from the id-token claims, IP + User-Agent capture, first-login activation + pending invitation acceptance.
  • Build V2 Action webhook handlers via ZitadelWebhookDescriptor + ZitadelWebhookCatalog โ€” typed event keys, route declaration, secret rotation, validation.
  • Plug into a CLI through the included ZitadelWebhookCommand โ€” declarative webhook synchronization between Zitadel and the application.

Under the hood

  • A consistent set of typed enums and constants โ€” ZitadelEndpoint, ZitadelEndpointPlaceholder, ZitadelScope, ZitadelGrant, ZitadelQueryMethod, ZitadelError, ZitadelErrorId, ZitadelOutcome, ZitadelSessionField, ZitadelSessionSearchParam, ZitadelMessageKeyword, ZitadelOutput, ZitadelAppAuthMethod, ZitadelCookie โ€” no magic strings.
  • Pure-PHP HTTP transport based on GuzzleHttp v7.
  • JWT/JWKS verification through firebase/php-jwt v7.
  • Persistence delegated to oihana/php-arango for OAuth client mirror + session storage.

โœ… Running tests

Run all tests:

composer test

Run a specific test file:

composer test ./tests/oihana/zitadel/webhooks/ZitadelWebhookDescriptorTest.php

The unit tests cover the OAuth client resolver, the session creator trait (with a PSR-7 mocked request), the webhook catalog and descriptor, the webhook command, error ids and selected client traits โ€” they run without a live Zitadel instance.

๐Ÿ› ๏ธ Generate the documentation

We use phpDocumentor to generate documentation into the ./docs folder.

composer doc

๐Ÿงพ License

Licensed under the Mozilla Public License 2.0 (MPLโ€‘2.0).

๐Ÿ‘ค About the author

  • Author: Marc ALCARAZ (aka eKameleon)
  • Email: marc@ooop.fr
  • Website: https://www.ooop.fr

๐Ÿ”— Related packages

Package Description
oihana/php-arango Composable toolkit for ArangoDB โ€” document/edge models, AQL helpers, controllers.
oihana/php-auth Casbin RBAC + JWT/OIDC authorization toolkit.
oihana/php-commands Symfony Console kernel and reusable command traits.
oihana/php-core Core helpers and utilities shared across the ecosystem.
oihana/php-enums Typed constants and enums โ€” no more magic strings.
oihana/php-files File system helpers (paths, readers, writers).
oihana/php-http HTTP helpers โ€” client IP, cookies, route patterns.
oihana/php-reflect Reflection and object hydration utilities.
oihana/php-schema Schema.org constants and vocabulary.
oihana/php-system Framework helpers โ€” controllers, models, request handling.