The PHP SDK communicates differently with LaunchDarkly than the other SDKs because it does not support long-lived streaming connections. It must either use HTTP to poll for flags on demand, or get them from Redis or another database.
We recommend using a database, as it is more efficient. To learn more, read Daemon Mode.
If you don't use a database, the Relay Proxy can handle HTTP requests from PHP (proxy mode). However, we strongly recommend that if you do this, you use the ttlMinutes
parameter in the environment configuration to enable HTTP caching. This is equivalent to the TTL setting for the environment on your LaunchDarkly dashboard, but must be set here separately because the Relay Proxy does not have access to those dashboard properties. This causes HTTP responses from the PHP endpoints to have a Cache-Control: max-age
so the PHP SDK will not make additional HTTP requests for the same flag more often than that interval.
This configuration may result in different PHP application instances receiving flag updates at slightly different times, because their HTTP caches will not be exactly in sync.