For the complete documentation index, see llms.txt. This page is also available as Markdown.

Feature Flag Decision

A Feature Flag has an on state and an off state. A different feature is configured for each state. When a user accesses a feature that has a Feature Flag applied, the on or off state must be returned. You can perform this state decision through the Hackle SDK.

isFeatureOn

By passing a Feature Key to the isFeatureOn() method, you can receive the state result for the user. Then implement logic based on the state.

In the example code below, Feature Key 42 is passed, and the User Identifier for the user whose state is to be determined is "ae03e1adf".

<?php

require 'vendor/autoload.php';

$client = \Hackle\HackleClients::create("YOUR_SERVER_SDK_KEY");

$user = \Hackle\Common\HackleUser::builder()
    ->deviceId("ae2182e0")
    ->build();

$isFeatureOn = $client->isFeatureOn(42, $user);

if ($isFeatureOn) {
    // ON 기능
} else {
    // OFF 기능
}

?>

featureFlagDetail

The featureFlagDetail() method works the same as the isFeatureOn() method and additionally provides the reason for the state decision. It is useful for checking whether Override is working correctly or when the result ratio seems unusual relative to the configured Traffic Allocation.

You must pass the Feature Key as a parameter. In the example code below, Feature Key 42 is passed.

The state decision reason is returned in the form of SDK_NOT_READY. Refer to the table below for details.

Decision Reason
Description
Distribution Result

SDK_NOT_READY

The SDK is not ready to use. (e.g., initialization attempted with an invalid SDK Key)

Default state (off)

FEATURE_FLAG_NOT_FOUND

No Feature Flag was found for the provided Feature Key. The Feature Key may be incorrect, or the Feature Flag may be archived.

Default state (off)

FEATURE_FLAG_INACTIVE

The Feature Flag is in the off state.

Default state (off)

INDIVIDUAL_TARGET_MATCH

Matched by Individual Targeting.

State configured by Individual Targeting

TARGET_RULE_MATCH

Matched by User Targeting.

State configured by User Targeting

DEFAULT_RULE

Did not match either Individual Targeting or User Targeting.

State configured by default rule

EXCEPTION

An unknown error occurred.

Default state (off)

Feature Flag Parameter Settings

  • You can also receive the parameter values for the state decision through the featureFlagDetail() method.

  • Since parameter values configured on the Hackle Feature Flag screen exist as key-value pairs, you can use the methods below according to the configured parameter type to receive and use the configured parameter value.

  • You can dynamically change values on the Feature Flag parameter settings screen.

getString

  • Returns parameter values configured as STRING or JSON type.

  • Returns the default value or the value configured in the rule, depending on the state decision.

getInt

  • Returns the parameter value configured as Number type as an Int type.

  • Returns the default value or the value configured in the rule, depending on the state decision.

getFloat

  • Returns the parameter value configured as Number type as a float type.

  • Returns the default value or the value configured in the rule, depending on the state decision.

getBool

  • Returns parameter values configured as Boolean type.

  • Returns the default value or the value configured in the rule, depending on the state decision.

Last updated