Configuration
Customize the plugin for your needs.
Config file #
Create a config/feature-flags.php file in your Craft project to override default settings:
<?php
return [
'pluginName' => 'Feature Flags',
'cacheTtl' => 60,
'enableAuditLog' => true,
'anonymousCookieName' => '_ff_vid',
'anonymousCookieTtl' => 31536000,
];
Settings #
pluginName
- Type:
?string - Default:
null
Overrides the plugin’s label in the control panel sidebar. When null, the sidebar displays “Feature Flags”.
cacheTtl
- Type:
int - Default:
60
How long (in seconds) flag data is cached after being read from the database. Each flag is cached individually by handle.
Setting this to 0 disables caching entirely — every isEnabled() call queries the database directly. This is useful during development but not recommended for production.
The cache is automatically invalidated whenever a flag is saved, toggled, or deleted.
enableAuditLog
- Type:
bool - Default:
true
When enabled, the plugin records an audit log entry every time a flag is created, updated, toggled, or deleted. The log includes the action, the user who performed it, and a snapshot of the flag’s state.
Set to false to disable audit logging entirely.
anonymousCookieName
- Type:
string - Default:
'_ff_vid'
The name of the cookie used to store a stable identifier for anonymous visitors. This identifier is used as the bucket input for percentage rollouts when no user is logged in.
anonymousCookieTtl
- Type:
int - Default:
31536000(1 year)
How long (in seconds) the anonymous visitor cookie persists. After this period, the visitor gets a new identifier and may land in a different rollout bucket.
Setting this to 0 disables anonymous visitor bucketing entirely. Percentage rollouts will have no effect on anonymous visitors — the flag will fall through to false for them.
Permissions #
The plugin registers two permissions that can be assigned to Craft user groups:
| Permission | Handle | Description |
|---|---|---|
| View feature flags | featureFlags:view | Allows viewing the flag list and flag details in the control panel. |
| Manage feature flags | featureFlags:manage | Allows creating, editing, toggling, and deleting flags. Nested under the view permission — a user must have view access to be granted manage access. |
Admins always have full access regardless of permission settings.