You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+33-14Lines changed: 33 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -64,33 +64,52 @@ With Guzzle, you could persist your cache somewhere other than the default in-me
64
64
Using LD-Relay
65
65
==============
66
66
67
-
The LaunchDarkly Relay Proxy ([ld-relay](https://github.com/launchdarkly/ld-relay)) consumes the LaunchDarkly streaming API and can update
68
-
a Redis cache operating in your production environment. The ld-relay offers many benefits such as performance and feature flag consistency. With PHP applications, we strongly recommend setting up ld-relay with a Redis store.
67
+
The LaunchDarkly Relay Proxy ([ld-relay](https://github.com/launchdarkly/ld-relay)) consumes the LaunchDarkly streaming API and can update a database cache operating in your production environment. The ld-relay offers many benefits such as performance and feature flag consistency. With PHP applications, we strongly recommend setting up ld-relay with a database store. The database can be Redis or DynamoDB. (For more about using LaunchDarkly with Redis or DynamoDB, see the [SDK reference guide](https://docs.launchdarkly.com/v2.0/docs/using-a-persistent-feature-store).)
69
68
70
69
1. Set up ld-relay in [daemon-mode](https://github.com/launchdarkly/ld-relay#redis-storage-and-daemon-mode) with Redis
71
70
72
-
2. Require Predis as a dependency:
71
+
2. Add the necessary dependency for the chosen database.
72
+
73
+
For Redis:
73
74
74
75
php composer.phar require "predis/predis:1.0.*"
75
76
76
-
3. Create the LDClient with the Redis feature requester as an option:
77
+
For DynamoDB:
78
+
79
+
php composer.phar require "aws/aws-sdk-php:3.*"
80
+
81
+
3. Create the LDClient with the appropriate parameters for the chosen database. These examples show all of the available options.
82
+
83
+
For Redis:
77
84
78
85
$client = new LaunchDarkly\LDClient("your_sdk_key", [
'redis_host' => 'your.redis.host', // defaults to "localhost" if not specified
88
+
'redis_port' => 6379, // defaults to 6379 if not specified
89
+
'redis_timeout' => 5, // connection timeout in seconds; defaults to 5
90
+
'redis_prefix' => 'env1' // corresponds to the prefix setting in ld-relay
91
+
'predis_client' => $myClient // use this if you have already configured a Predis client instance
82
92
]);
83
93
84
-
4. If ld-relay is configured for [event forwarding](https://github.com/launchdarkly/ld-relay#event-forwarding), you can configure the LDClient to publish events to ld-relay instead of directly to `events.launchdarkly.com`. Using `GuzzleEventPublisher` with ld-relay event forwarding can be an efficient alternative to the default `curl`-based event publishing.
94
+
For DynamoDB:
85
95
86
96
$client = new LaunchDarkly\LDClient("your_sdk_key", [
'dynamodb_prefix' => 'env1', // corresponds to the prefix setting in ld-relay
100
+
'dynamodb_options' => array(), // you may pass any options supported by the AWS SDK
101
+
'apc_expiration' => 30 // expiration time for local caching, if you have apcu installed
92
102
]);
93
103
104
+
4. If you are using DynamoDB, you must create your table manually. It must have a partition key called "namespace", and a sort key called "key" (both strings). Note that by default the AWS SDK will attempt to get your AWS credentials and region from environment variables and/or local configuration files, but you may also specify them in `dynamodb_options`.
105
+
106
+
5. If ld-relay is configured for [event forwarding](https://github.com/launchdarkly/ld-relay#event-forwarding), you can configure the LDClient to publish events to ld-relay instead of directly to `events.launchdarkly.com`. Using `GuzzleEventPublisher` with ld-relay event forwarding can be an efficient alternative to the default `curl`-based event publishing.
107
+
108
+
To forward events, add the following configuration properties to the configuration shown above:
We encourage pull-requests and other contributions from the community. We've also published an [SDK contributor's guide](http://docs.launchdarkly.com/docs/sdk-contributors-guide) that provides a detailed explanation of how our SDKs work.
113
132
114
133
About LaunchDarkly
115
-
-----------
134
+
------------------
116
135
117
136
* LaunchDarkly is a continuous delivery platform that provides feature flags as a service and allows developers to iterate quickly and safely. We allow you to easily flag your features and manage them from the LaunchDarkly dashboard. With LaunchDarkly, you can:
118
137
* Roll out a new feature to a subset of your users (like a group of users who opt-in to a beta tester group), gathering feedback and bug reports from real-world use cases.
0 commit comments