Skip to content

PAM Native Feature Flags

Every PAM Native product runs on the PAM runtime. Install and verify PAM first, create a Native application, and add this package through PAM Composer:

Terminal window
curl -fsSL https://github.com/push-in/pam/releases/latest/download/install.sh | sh
pam doctor
pam init my-app --template native
cd my-app
pam composer require pushinbr/pam-native-feature-flags
pam doctor
pam native dev
$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.

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.