PHP client for evaluating Togul feature flags with local TTL caching and fallback behavior.
composer require togul/php-sdk<?php
use Togul\Config;
use Togul\FallbackMode;
use Togul\TogulClient;
$client = new TogulClient(new Config(
environment: 'production',
apiKey: 'your-environment-api-key',
timeout: 5.0,
cacheTtl: 30,
fallbackMode: FallbackMode::FailClosed,
retryCount: 2,
));
$enabled = $client->isEnabled('new-dashboard', [
'user_id' => 'user-123',
'country' => 'TR',
]);apiKeymust be an environment API key, not a user JWT.- Requests are sent to
POST /api/v1/evaluatewith theX-API-Keyheader. - The cache key includes the full evaluation context.
- The client retries
429and5xx, but stops immediately on401/403/404.