Stable tag: 0.3.2 Requires at least: 6.2 Tested up to: 6.8 Requires PHP: 8.1
WordPress Feature flags plugin allow developers to configure features in plugins/themes behind the feature flags on both the server (PHP) and client (JS/TS) side.
composer require codeb/wp-feature-flags
Packagist: https://packagist.org/packages/codeb/wp-feature-flags
Filter to define the maximum number of allowed flags. It is recommended to keep this to default value, which is 20.
Example usage:
add_filter(
'codeb_feature_flags_max_allowed',
static function () {
return 10;
}
);The filter controls whether the new flag is enabled by default or not. Default true
Example usage:
addFilter(
'codebFeatureFlags.newFlag.defaultStatus',
'codeb-feature-flags',
() => {
return false;
}
);To build the plugin
PHP setup
composer install
JS setup
yarn installyarn buildto create the buildyarn startto start the watch mode
This plugin uses wp-env setup to for local environment.
wp-env startto start the containerswp-env stopto stop the containers
More details on how to access local environment can be found here.
PHP
composer lintcomposer lint:fixto auto fix PHP linting errors.
JS
yarn lint:jsyarn lint:js:fixto auto fix JS linting errors.
CSS
yarn lint:cssyarn lint:css:fixto auto fix CSS linting errors.
The WordPress unit and integration tests depends on wp-env setup. Ensure you run yarn wp-env:coverage before running
the tests.
- To run unit tests
yarn php:unit - To run integrations tests
yarn php:integration - To run integrations tests as multisite
yarn php:multisite
- Run
yarn test:jsto run all Jest and React Testing Library tests
The E2E tests depends on wp-env setup. Ensure you run wp-env start before running the tests.
- Run
yarn test:e2eto run all Playwright e2e tests.
Code contributions, feedback, issue reporting and feature suggestions are welcome. See CONTRIBUTING.md for more details.