Remote Config Appliance

๐Ÿ“˜

Remote Configuration

Remote Configuration is a feature that allows you to control the behavior and settings of your application in real-time by replacing values or properties managed within the application with parameter values defined in the Hackle dashboard. Parameters can be set for any attribute of the client/server-side application, such as button color or external links.

To configure the parameter information, navigate to the Remote Configuration page in the Hackle dashboard and set the values according to the user identification rules. To apply the values set in the Hackle Remote Configuration page in your application, you need to use the following features provided by the Hackle SDK.

By utilizing the following features provided by the Hackle SDK and applying the desired values in your code, you can quickly apply the changes without the need for deployment.

remoteConfig

By calling the remoteConfig() method, you can obtain a HackleRemoteConfig instance that contains the remote configuration information (parameters and rule information) for the user. The remoteConfig() method accepts user identification information to match user attributes with the rules in the remote configuration. You can access the desired parameters and retrieve their values using the methods provided by HackleRemoteConfig.

<?php

require 'vendor/autoload.php';

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

// User object - Refer to the user identifier and properties guide  
$user = \\Hackle\\Common\\HackleUser::of("ae2182e0");

// Returns an instance containing the remote configuration information  
$remoteConfig = $client->remoteConfig($user);

?>

Retrieving Remote Configuration Parameters

Since the parameters set in the Hackle Remote Configuration page exist as key-value pairs, you can use the following methods to retrieve the values based on the parameter type you set.

๐Ÿšง

Remove the code related to remote configuration after storing it.

If you have stored the remote configuration parameters, you will no longer be able to access the parameter information. Therefore, make sure to clean up the relevant code after storing the remote configuration parameters.

getString

  • Returns the parameter value that is set as STRING or JSON type.
  • Depending on the state decision, it returns either the default value or the value set in the rules.
<?php

require 'vendor/autoload.php';

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

// User object - Refer to the user identifier and properties guide  
$user = \\Hackle\\Common\\HackleUser::of("ae2182e0");

// Returns an instance containing the remote configuration information  
$remoteConfig = $client->remoteConfig($user);

$strValue = $remoteConfig->getString("parameter_key_string_type", "defaultValue");

// JSON String  
$jsonValue = $remoteConfig->getString("parameter_key_json_type", "defaultValue");

?>

getInt

  • Returns the parameter value that is set as Number type as an Int type.
  • Depending on the state decision, it returns either the default value or the value set in the rules.
<?php

require 'vendor/autoload.php';

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

// User object - Refer to the user identifier and properties guide
$user = \Hackle\Common\HackleUser::of("ae2182e0");

// Returns an instance containing the remote configuration information
$remoteConfig = $client->remoteConfig($user);

$intValue = $remoteConfig->getInt("parameter_key_number_type", 0);

?>

getFloat

  • Returns the parameter value that is set as Number type as a float type.
  • Depending on the state decision, it returns either the default value or the value set in
<?php

require 'vendor/autoload.php';

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

// User object - Refer to the user identifier and properties guide
$user = \Hackle\Common\HackleUser::of("ae2182e0");

// Returns an instance containing the remote configuration information
$remoteConfig = $client->remoteConfig($user);

$floatValue = $remoteConfig->getFloat("parameter_key_number_type", 0.0);

?>

getBool

  • Returns the parameter value that is set as a Boolean type.
  • Depending on the state decision, it returns either the default value or the value set in
<?php

require 'vendor/autoload.php';

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

// User object - Refer to the user identifier and properties guide
$user = \Hackle\Common\HackleUser::of("ae2182e0");

// Returns an instance containing the remote configuration information
$remoteConfig = $client->remoteConfig($user);

$boolValue = $remoteConfig->getBool("parameter_key_bool_type", true);

?>