configcat/openfeature-provider

ConfigCat OpenFeature Provider for PHP.

v1.0.0 2024-08-08 12:41 UTC

This package is auto-updated.

Last update: 2024-09-08 16:05:42 UTC


README

Build Status Latest Stable Version Total Downloads

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?

https://configcat.com/support

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.