morningmedley/feature-flagging

Flag some features

Maintainers

Package info

github.com/Morning-Train/Medley-Feature-Flagging

pkg:composer/morningmedley/feature-flagging

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.4.0 2026-04-24 13:12 UTC

This package is not auto-updated.

Last update: 2026-04-29 07:25:20 UTC


README

Additional help for working with features in WordPress.

📋 Table of Contents

[[TOC]]

✨ Installation

Using Composer

composer require morningmedley/feature-flagging

🔥 Usage

There are a couple of different ways to define or create a feature as shown below:

// Add an already defined feature
Feature::register(new \MedleyApp\CopyrightFeature());

// Add a feature that always does its thing
Feature::register(function () {
    // Do something always
});

// Add a feature with a service provider 
Feature::register(MyCoolServiceProvider::class);

// Add a feature that never does its thing
Feature::register(function () {
    // Do something never
}, false);

// Add a feature that does its thing when the condition is true
Feature::register(function () {
    // Do something sometimes
}, \Illuminate\Support\Lottery::odds(1/5));

// Add a feature to display a message to users if an admin has enabled it for the site or sub-site
Feature::register(new \MorningMedley\FeatureFlagging\Classes\FeatureTypes\WpAdminManagedFeature(
    function () {
        echo "Hello!";
    },
    'say-hello',
    __("Say Hello", 'foo'),
    __("Display a greeting to users.", 'foo'),
));

🦄 Team

Developed by
Morningtrain logo