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.
Installs: 709 748
Dependents: 5
Suggesters: 1
Security: 0
Stars: 20
Watchers: 5
Forks: 11
Open Issues: 0
Requires
- php: >=8.1
- ext-json: *
- guzzlehttp/guzzle: ^7.0
- psr/http-client: ^1.0
- psr/log: ^2.0|^3.0
- z4kn4fein/php-semver: ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- illuminate/cache: ^9.0
- phpstan/phpstan: ^1.0
- phpunit/phpunit: ^9
- psr/cache: ^1.0
- psr/simple-cache: ^3.0
Suggests
- laravel/framework: When using laravel, a pre-built cache adapter \ConfigCat\LaravelCache can be used as the main cache of the library.
- psr/cache: When using any PSR6 Cache implementation, a pre-built cache adapter \ConfigCat\Psr6Cache can be used as the main cache of the library.
- psr/simple-cache: When using any PSR16 SimpleCache implementation, a pre-built cache adapter \ConfigCat\Psr16Cache can be used as the main cache of the library.
- dev-master
- v9.2.0
- v9.1.1
- v9.1.0
- v9.0.0
- v8.1.0
- v8.0.0
- v7.1.1
- v7.1.0
- v7.0.1
- v7.0.0
- v6.2.1
- v6.2.0
- v6.1.0
- v6.0.0
- v5.4.1
- v5.4.0
- v5.3.1
- v5.3.0
- v5.2.1
- v5.2.0
- v5.1.0
- v5.0.0
- v4.1.0
- v4.0.1
- v4.0.0
- v3.0.3
- v3.0.2
- v3.0.1
- v3.0.0
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- v1.2.0
- v1.1.0
- 1.0.0
- dev-prepare-v9.1.0
- dev-minor-corrections
- dev-config-v6
This package is auto-updated.
Last update: 2024-10-23 08:00:33 UTC
README
ConfigCat SDK for PHP provides easy integration for your application to 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.
Requirements
- PHP >= 8.1
ConfigCat SDK for PHP >= 7.1 is available here.
Getting started
1. Install the package with Composer
composer require configcat/configcat-client
2. Go to the ConfigCat Dashboard to get your SDK Key:
3. Create the ConfigCat client instance
$client = new \ConfigCat\ConfigCatClient("#YOUR-SDK-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
Need help?
Contributing
Contributions are welcome. For more info please read the Contribution Guideline.