Official PHP middleware library for Zitadel authentication using the OAuth 2.0 Authorization Code + PKCE flow.
- Zero server-side sessions — all state in encrypted HttpOnly cookies
- Zero custom routes — middleware intercepts callback and logout automatically
- Zero external runtime dependencies — only
ext-openssl,ext-sodium,ext-curl - PHP 8.3+ with full
readonly classimmutability - Supports Laravel, Symfony, Yii 3, CodeIgniter 4, and Phalcon
composer require zitadel/sdkAuto-discovered. Set environment variables and optionally publish config:
php artisan vendor:publish --tag=zitadel-config// config/bundles.php
Zitadel\Sdk\Bridge\Symfony\ZitadelBundle::class => ['all' => true],Register the bridge middleware and its router bindings in config/web/di.php:
use Zitadel\Sdk\Bridge\Yii\ZitadelMiddleware;
use Yiisoft\Router\FastRoute\UrlMatcher;
use Yiisoft\Router\UrlMatcherInterface;
// ... see docs/yii.rst for the full DI configPlace ZitadelMiddleware::class before Router::class in your middleware pipeline.
use Zitadel\Sdk\Middleware\ZitadelMiddleware;
$app->add(new ZitadelMiddleware($config, $validator, $responseFactory));$config = new ZitadelConfig(
issuerUrl: 'https://my.zitadel.cloud',
clientId: 'your-client-id',
redirectUri: 'https://myapp.com/zitadel/callback',
cookieSecret: bin2hex(random_bytes(32)), // generate once, store in env
protectAll: true,
ignoredRoutes: ['/health', '/'],
);See docs/index.rst or the per-framework guides in docs/.
Apache 2.0 — see LICENSE.