configcat/configcat-client

ConfigCat is a feature flag, feature toggle, and configuration management service. That lets you launch new features and change your software configuration remotely without actually (re)deploying code. ConfigCat even helps you do controlled roll-outs like canary releases and blue-green deployments.

1.0.0 2019-01-08 22:31 UTC

README

ConfigCat SDK for PHP provides easy integration between ConfigCat service and applications using PHP.

ConfigCat is a feature flag, feature toggle, and configuration management service. That lets you launch new features and change your software configuration remotely without actually (re)deploying code. ConfigCat even helps you do controlled roll-outs like canary releases and blue-green deployments. https://configcat.com

Build Status Coverage Status Latest Stable Version Total Downloads Latest Unstable Version

Getting started

1. Install the package with Composer

composer require configcat/configcat-client

2. Log in to ConfigCat Management Console and go to your Project to get your API Key:

API-KEY

3. Create the ConfigCat client instance

$client = new \ConfigCat\ConfigCatClient("#YOUR-API-KEY#");

4. Get your setting value:

$isMyAwesomeFeatureEnabled = $client->getValue("isMyAwesomeFeatureEnabled", false);
if(is_bool($isMyAwesomeFeatureEnabled) && $isMyAwesomeFeatureEnabled) {
    doTheNewThing();
} else {
    doTheOldThing();
}

Getting user specific setting values with Targeting

Using this feature, you will be able to get different setting values for different users in your application by passing a User Object to the getValue() function.

Read more about Targeting here.

User object

Percentage and targeted rollouts are calculated by the user object you can optionally pass to the configuration requests. The user object must be created with a mandatory identifier parameter which should uniquely identify each user:

$user = new \ConfigCat\User("#USER-IDENTIFIER#"); // mandatory

$isMyAwesomeFeatureEnabled = $client->getValue("isMyAwesomeFeatureEnabled", false, $user);
if(is_bool($isMyAwesomeFeatureEnabled) && $isMyAwesomeFeatureEnabled) {
    doTheNewThing();
} else {
    doTheOldThing();
}

Sample/Demo app

Support

If you need help how to use this SDK feel free to to contact the ConfigCat Staff on https://configcat.com. We're happy to help.

Contributing

Contributions are welcome.

About ConfigCat