Skip to content

Commit 4e7022a

Browse files
authored
Merge pull request #3 from launchdarkly/adam/ld-relay-reference
clarifying ld-relay usage
2 parents 35cb326 + 90e6bad commit 4e7022a

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

README.md

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,29 +41,38 @@ Your first feature flag
4141
Fetching flags
4242
--------------
4343

44-
There are two approaches to fetching the flag rules from LaunchDarkly:
44+
There are two distinct methods of integrating LaunchDarkly in a PHP environment.
4545

46-
* Making HTTP requests (using Guzzle)
47-
* Setting up the [ld-relay](https://github.com/launchdarkly/ld-relay) to store the flags in Redis
46+
* [Guzzle Cache Middleware](https://github.com/Kevinrob/guzzle-cache-middleware) to request and cache HTTP responses in an in-memory array (default)
47+
* [ld-relay](https://github.com/launchdarkly/ld-relay) to retrieve and store flags in Redis (recommended)
48+
49+
We strongly recommend using the ld-relay. Per-flag caching (Guzzle method) is only intended for low-throughput environments.
4850

4951
Using Guzzle
5052
============
5153

52-
To use Guzzle it must be required as a dependency:
54+
Require Guzzle as a dependency:
5355

5456
php composer.phar require "guzzlehttp/guzzle:6.2.1"
5557
php composer.phar require "kevinrob/guzzle-cache-middleware:1.4.1"
5658

5759
It will then be used as the default way of fetching flags.
5860

59-
Using Redis
60-
===========
61+
With Guzzle, you could persist your cache somewhere other than the default in-memory store, like Memcached or Redis. You could then specify your cache when initializing the client with the [cache option](https://github.com/launchdarkly/php-client/blob/master/src/LaunchDarkly/LDClient.php#L42).
62+
63+
$client = new LaunchDarkly\LDClient("YOUR_SDK_KEY", array("cache" => $cacheStorage));
64+
65+
66+
Using LD-Relay
67+
==============
68+
69+
* Setup [ld-relay](https://github.com/launchdarkly/ld-relay) in [daemon-mode](https://github.com/launchdarkly/ld-relay#redis-storage-and-daemon-mode) with Redis
6170

62-
1. Require Predis as a dependency:
71+
* Require Predis as a dependency:
6372

6473
php composer.phar require "predis/predis:1.0.*"
6574

66-
2. Create the LDClient with the Redis feature requester as an option:
75+
* Create the LDClient with the Redis feature requester as an option:
6776

6877
$client = new LaunchDarkly\LDClient("your_sdk_key", ['feature_requester_class' => 'LaunchDarkly\LDDFeatureRequester', 'redis_host' => 'your.redis.host', 'redis_port' => 6379]);
6978

0 commit comments

Comments
 (0)