PAM Native Feature Flags
pam add feature-flagspam doctor$provider = new InMemoryFlagProvider([ new FlagDefinition( 'checkout.new', FlagValue::boolean(false), rules: [ new TargetingRule('brazil-pro', [ new Condition('country', ConditionOperator::Equals, 'BR'), ], FlagValue::boolean(true)), ], rollout: [new PercentageRollout(1_000, FlagValue::boolean(true))], ),]);
$flags = new FeatureFlags($provider, new EvaluationContext($user->id, ['country' => 'BR']));if ($flags->boolean('checkout.new')) { /* new checkout */ }FeatureFlags evaluates typed values and overrides. Definitions combine safe
defaults, TargetingRule, conditions, and rollouts; EvaluationContext
provides stable bucketing identity; FlagProvider supplies definitions; and
SnapshotStore persists offline snapshots limited to 1 MiB.
Rollouts hash flag-key + NUL + bucketing-id with SHA-256 and map the first
unsigned 32 bits into 0–9999. Golden tests keep PHP/Kotlin/Swift assignments
identical. Use a stable non-secret ID, emit exposure once per decision rather
than render, and always retain an offline/malformed-config default.
Public model
Section titled “Public model”Evaluator produces an Evaluation with EvaluationReason and optional
Exposure. FlagValueKind identifies the typed value representation.
JsonFlagProvider loads bounded JSON definitions, while
InMemoryFlagProvider is useful for embedded defaults and tests.
FeatureFlagsPluginProvider is discovered automatically by PAM.