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
+17-8Lines changed: 17 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,29 +41,38 @@ Your first feature flag
41
41
Fetching flags
42
42
--------------
43
43
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.
45
45
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.
48
50
49
51
Using Guzzle
50
52
============
51
53
52
-
To use Guzzle it must be required as a dependency:
It will then be used as the default way of fetching flags.
58
60
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
61
70
62
-
1. Require Predis as a dependency:
71
+
* Require Predis as a dependency:
63
72
64
73
php composer.phar require "predis/predis:1.0.*"
65
74
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:
0 commit comments