jacobbuck/silverstripe-flags

Feature flag toggling for SilverStripe.

Installs: 10 181

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 2

Open Issues: 0

Type:silverstripe-vendormodule

2.0.0 2020-01-09 21:45 UTC

This package is not auto-updated.

Last update: 2020-07-10 02:24:55 UTC


README

Feature flag toggling for SilverStripe.

Usage

Add your flags to your website or module config:

JacobBuck\Flags\Flag:
  flags:
    - Name: coolFeature
      Description: "Enable website to use cool feature."
      Enabled: true
    - Name: debugAnotherFeature
      Description: "For developers to debug another feature."
    - Name: experimentalThing
      Description: "Enables experimental thing."

You can then write code to be conditional based on if a flag is enabled:

    use JacobBuck\Flags\Flag;
    
    ...
    
    if (Flag::isEnabled('coolFeature')) {
        // Do something cool
    }
    <% if FlagEnabled("experimentalThing") %>
        <%-- Experimental thing template --%>
    <% end_if %>

Flags can be toggled in the CMS:

screenshot

screenshot

You can also see the history of changes to a flag:

screenshot

Requirements

  • Silverstripe 4+

Installation

The recommended way to install is through Composer:

composer require jacobbuck/silverstripe-flags