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.
Requires
- php: >=8.4
- firebase/php-jwt: ^7.0
- guzzlehttp/guzzle: ^7.10
- oihana/php-arango: dev-main
- oihana/php-auth: dev-main
- oihana/php-commands: dev-main
- oihana/php-core: dev-main
- oihana/php-enums: dev-main
- oihana/php-files: dev-main
- oihana/php-http: dev-main
- oihana/php-reflect: dev-main
- oihana/php-schema: dev-main
- oihana/php-system: dev-main
- php-di/php-di: ^7.0
- psr/container: ^2.0
- psr/http-message: ^2.0
- psr/log: ^3.0
- symfony/console: ^7.0 || ^8.0
Requires (Dev)
- nunomaduro/collision: ^8.8
- phpdocumentor/shim: ^3.8
- phpunit/phpunit: ^12
- slim/psr7: ^1.7
This package is auto-updated.
Last update: 2026-05-25 19:45:48 UTC
README
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.
๐ 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 + ArangoDBoauth_clientsmirror + 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-arangofor 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. |
