configcat / openfeature-provider
ConfigCat OpenFeature Provider for PHP.
Requires
- php: >=8.1
- configcat/configcat-client: ^9.2
- open-feature/sdk: ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- phpstan/phpstan: ^1.0
- phpunit/phpunit: ^9
README
This repository contains an OpenFeature provider that allows ConfigCat to be used with the OpenFeature PHP SDK.
Requirements
- PHP >= 8.1
Installation
composer require configcat/openfeature-provider
Usage
The ConfigCatProvider
constructor takes the SDK key and an optional array
argument containing the additional configuration options for the ConfigCat PHP SDK:
// Acquire an OpenFeature API instance. $api = OpenFeatureAPI::getInstance(); // Build options for the ConfigCat SDK. $options = [ ClientOptions::LOG_LEVEL => LogLevel::WARNING, ClientOptions::CACHE_REFRESH_INTERVAL => 5, //... ]; // Configure the provider. $api->setProvider(new ConfigCatProvider('<YOUR-CONFIGCAT-SDK-KEY>', $options)); // Create a client. $client = $api->getClient(); // Evaluate a feature flag. $isMyAwesomeFeatureEnabled = $client->getBooleanValue('isMyAwesomeFeatureEnabled', false);
For more information about all the configuration options, see the PHP SDK documentation.
Need help?
Contributing
Contributions are welcome. For more info please read the Contribution Guideline.
About ConfigCat
ConfigCat is a feature flag and configuration management service that lets you separate releases from deployments. You can turn your features ON/OFF using ConfigCat Dashboard even after they are deployed. ConfigCat lets you target specific groups of users based on region, email or any other custom user attribute.
ConfigCat is a hosted feature flag service. Manage feature toggles across frontend, backend, mobile, desktop apps. Alternative to LaunchDarkly. Management app + feature flag SDKs.