This package provides an integration for ConfigCat in Spryker.
- Install the package via composer
composer require turbine-kreuzberg/spryker-configcat
For an easy start, copy the following snippet to your config_local.php
$config[FeatureFlagConstants::SDK_KEY] = 'CONFIG-CAT-KEY';
$config[FeatureFlagConstants::CACHE_REFRESH_INTERVAL] = REFRESH_INTERVAL;
You can use it as a Client dependency in your bundles.
Example snippet:
$featureFlagClient = $this->getFactory()->getFeatureFlagClient();
if ($featureFlagClient->isFeatureOn('testFeature')) {
echo('Feature is on!');
}
To have feature flag independent of configCat in tests you can set a default value in configFile
$config[FeatureFlagConstants::CONFIG_CAT_FEATURE_FLAGS] = [
'feature_flag_in_config_file' => true,
'feature flag 2' => false,
'feature flag 3' => true,
];
The MIT License (MIT). Please see License File for more information.