Skip to main content

FeatureFlag

Plan/Subscription-based feature gating with 3-tier override (restriction only) β€” Layer 0 Foundation

Status​

KeyValue
Layerfoundation
TierL0
Statuswip
Version0.9.0
PriceFree (free)
CategoryInfrastructure

Overview​

Overview​

FeatureFlag is the Layer 0 Foundation Plugin providing plan-based feature gating with 3-tier override (Plan β†’ SaaS β†’ Tenant).

Restriction-only rule: Child layers cannot grant broader permissions than parent.

Two value types​

State values (string)​

  • active (priority 0) β€” accessible
  • disabled (priority 1) β€” blocked (menu visible)
  • hidden (priority 2) β€” fully hidden

Numeric limits (int)​

  • -1 = unlimited
  • otherwise natural number = limit

FeatureValueResolver (Pure)​

use App\Plugins\FeatureFlag\Services\FeatureValueResolver;

$r = new FeatureValueResolver;
$r->applyRestriction('active', 'disabled'); // 'disabled'
$r->applyRestriction(100, 50); // 50
$r->isValidOverride('active', 'hidden'); // true
$r->applyChain(['active', 'disabled', 'hidden']); // 'hidden'

Status​

  • οΏ½ Phase 1+2 β€” Skeleton + Pure Resolver + 24 unit tests
  • ⬜ Phase 3 β€” Models + Migrations (Plan/Subscription/SaasOverride/TenantOverride)
  • ⬜ Phase 4 β€” FeatureAccess Service
  • ⬜ Phase 5 β€” scout.how adapter

Source​

Extracted from scout.how App\Services\FeatureAccess (243 LOC) β€” core logic only (applyRestriction, isValidOverride, STATE_PRIORITY).

Relationship​

Separate from Commerce:

  • Commerce: products / orders / payment
  • FeatureFlag: feature visibility / limits (gating)

Future integration: Commerce subscription β†’ FeatureFlag plan lifecycle.

License​

MIT

Demos​


πŸ›’ View on Plugin Store: store.codebase.how/plugins/feature-flag