PHPackages                             kernl/wp-feature-flags - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. kernl/wp-feature-flags

ActiveProject[Utility &amp; Helpers](/categories/utility)

kernl/wp-feature-flags
======================

Feature flagging for WordPress.

v1.1.0(6y ago)525MITPHPPHP &gt;=5.4

Since May 20Pushed 6y agoCompare

[ Source](https://github.com/wpkernl/WPFeatureFlags)[ Packagist](https://packagist.org/packages/kernl/wp-feature-flags)[ RSS](/packages/kernl-wp-feature-flags/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (8)Used By (0)

WP Feature Flags by Kernl.us
============================

[](#wp-feature-flags-by-kernlus)

This is the WordPress client library for Kernl feature flags. It makes using feature flags easy and adds some WordPress specific performance optimizations.

### Installation

[](#installation)

The best way to install the library is with Composer.

```
composer require kernl/wp-feature-flags

```

### Usage

[](#usage)

```
require __DIR__ . '/vendor/autoload.php';

// The feature flag product key.  This can be found in the Kernl web app
// in the "Feature Flags" menu.
$kernlFeatureFlagProductKey = '58cb023bc9689c1fe811615d';

// The user identifier is how Kernl identifies the user requesting flags.
// This should be unique for every user.
$userIdentifier = 'jack@kernl.us';

$kff = new kernl\WPFeatureFlags($kernlFeatureFlagProductKey, $userIdentifier);

// This says "For the product defined above, does this flag exists,
// and if so, is it active for the given user?".
if ($kff->active('GITHUB_ON_OFF')) {
    add_action('admin_notices', 'feature_flag_active');
}

function feature_flag_active() {
    ?>

        Great work!  The feature flag is active.
