Configuration

Customize the plugin for your needs.

Con­fig file #

Cre­ate a config/feature-flags.php file in your Craft project to over­ride default settings:

<?php

return [
    'pluginName' => 'Feature Flags',
    'cacheTtl' => 60,
    'enableAuditLog' => true,
    'anonymousCookieName' => '_ff_vid',
    'anonymousCookieTtl' => 31536000,
];

Set­tings #

pluginName

  • Type: ?string
  • Default: null

Over­rides the plugin’s label in the con­trol pan­el side­bar. When null, the side­bar dis­plays Fea­ture Flags”.

cacheTtl

  • Type: int
  • Default: 60

How long (in sec­onds) flag data is cached after being read from the data­base. Each flag is cached indi­vid­u­al­ly by handle.

Set­ting this to 0 dis­ables caching entire­ly — every isEnabled() call queries the data­base direct­ly. This is use­ful dur­ing devel­op­ment but not rec­om­mend­ed for production.

The cache is auto­mat­i­cal­ly inval­i­dat­ed when­ev­er a flag is saved, tog­gled, or deleted.

enableAuditLog

  • Type: bool
  • Default: true

When enabled, the plu­g­in records an audit log entry every time a flag is cre­at­ed, updat­ed, tog­gled, or delet­ed. The log includes the action, the user who per­formed it, and a snap­shot of the flag’s state.

Set to false to dis­able audit log­ging entirely.

anonymousCookieName

  • Type: string
  • Default: '_ff_vid'

The name of the cook­ie used to store a sta­ble iden­ti­fi­er for anony­mous vis­i­tors. This iden­ti­fi­er is used as the buck­et input for per­cent­age roll­outs when no user is logged in.

anonymousCookieTtl

  • Type: int
  • Default: 31536000 (1 year)

How long (in sec­onds) the anony­mous vis­i­tor cook­ie per­sists. After this peri­od, the vis­i­tor gets a new iden­ti­fi­er and may land in a dif­fer­ent roll­out bucket.

Set­ting this to 0 dis­ables anony­mous vis­i­tor buck­et­ing entire­ly. Per­cent­age roll­outs will have no effect on anony­mous vis­i­tors — the flag will fall through to false for them.

Per­mis­sions #

The plu­g­in reg­is­ters two per­mis­sions that can be assigned to Craft user groups:

Per­mis­sionHan­dleDescrip­tion
View fea­ture flagsfeatureFlags:viewAllows view­ing the flag list and flag details in the con­trol panel.
Man­age fea­ture flagsfeatureFlags:manageAllows cre­at­ing, edit­ing, tog­gling, and delet­ing flags. Nest­ed under the view per­mis­sion — a user must have view access to be grant­ed man­age access.

Admins always have full access regard­less of per­mis­sion settings.