turbine-kreuzberg / spryker-configcat
ConfigCat wrapper for spryker
Installs: 13 212
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 8
Forks: 1
Open Issues: 1
Requires
- php: >=8
- configcat/configcat-client: ^6.0.0
- psr/simple-cache: ^1.0.1
- spryker/kernel: ^3.54.0
- spryker/storage: ^3.18.0
Requires (Dev)
- codeception/codeception: 4.1.29
- codeception/module-asserts: ^1.0.0
- codeception/module-phpbrowser: ^1.0.0
- dg/bypass-finals: ^1.3
- phpstan/phpstan: 1.4.6
- spryker/code-sniffer: 0.17.4
- spryker/testify: 3.43.0
README
This package provides an integration for ConfigCat in Spryker.
Installation
- Install the package via composer
composer require turbine-kreuzberg/spryker-configcat
Configuration
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;
Usage
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!'); }
Tests
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, ];
Credits
License
The MIT License (MIT). Please see License File for more information.