configcat / configcat-client-php7
ConfigCat SDK for PHP 7. 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
Installs: 20 006
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 4
Forks: 0
Open Issues: 0
Requires
- php: >=7.1
- ext-json: *
- guzzlehttp/guzzle: ^6.3|^7.0
- psr/http-client: ^1.0
- psr/log: ^1.1
- z4kn4fein/php-semver: ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- illuminate/cache: ^5.0
- phpstan/phpstan: ^1.0
- phpunit/phpunit: ~7.0|^8
- psr/cache: ^1.0
- psr/simple-cache: ^1.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.
This package is auto-updated.
Last update: 2024-11-14 16:02:38 UTC
README
ConfigCat SDK for PHP 7 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 >= 7.1
ConfigCat SDK for PHP >= 8.1 is available here.
Getting started
1. Install the package with Composer
composer require configcat/configcat-client-php7
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.