LaunchDarkly PHP SDK 6.1.0

Files
in package

Integration with filesystem data.

Tags
since
3.5.0

Table of Contents

featureRequester()  : mixed
This component allows you to use local files as a source of feature flag state.

Methods

featureRequester()

This component allows you to use local files as a source of feature flag state.

public static featureRequester(string|array<string|int, string> $filePaths) : mixed

This would typically be used in a test environment, to operate using a predetermined feature flag state without an actual LaunchDarkly connection.

To use this component, create an instance of this class, passing the path(s) of your data file(s). Then place the resulting object in your LaunchDarkly client configuration with the key feature_requester.

$fr = LaunchDarkly\Integrations\Files::featureRequester("./testData/flags.json");
$config = [ "feature_requester" => $fr, "send_events" => false ];
$client = new LDClient("sdk_key", $config);

This will cause the client not to connect to LaunchDarkly to get feature flags. (Note that in this example, send_events is also set to false so that it will not connect to LaunchDarkly to send analytics events either.)

For more information about using this component, and the format of data files, see the SDK reference guide on "Reading flags from a file".

Parameters
$filePaths : string|array<string|int, string>

relative or absolute paths to the data files

Return values
mixed

an object to be stored in the feature_requester configuration property

Search results