Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Quick setup
0. Install the PHP SDK with [Composer](https://getcomposer.org/)

php composer.phar require launchdarkly/launchdarkly-php
php composer.phar require "guzzlehttp/guzzle:5.*"
php composer.phar require "guzzlehttp/cache-subscriber:0.1.*"

1. After installing, require Composer's autoloader:

Expand All @@ -34,6 +36,35 @@ Your first feature flag
# the code to run if the feature is off
}

Fetching flags
--------------

There are two approaches to fetching the flag rules from LaunchDarkly:

* Making HTTP requests (using Guzzle)
* Setting up the [ld-daemon](https://github.com/launchdarkly/ld-daemon) to store the flags in Redis

Using Guzzle
============

To use Guzzle it must be required as a dependency:

php composer.phar require "guzzlehttp/guzzle:5.*"
php composer.phar require "guzzlehttp/cache-subscriber:0.1.*"

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

Using Redis
===========

1. Require Predis as a dependency:

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

2. Create the LDClient with the Redis feature requester as an option:

$client = new LaunchDarkly\LDClient("your_api_key", ['feature_requester_class' => 'LaunchDarkly\LDDFeatureRequester']);

Learn more
-----------

Expand Down
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
machine:
php:
version: 5.4.37
version: 5.5.21

test:
override:
Expand Down
13 changes: 8 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,20 @@
}
],
"require": {
"php": ">=5.4",
"guzzlehttp/guzzle": "5.*",
"guzzlehttp/cache-subscriber": "0.1.*"
"php": ">=5.5"
},
"require-dev": {
"phpunit/phpunit": "4.3.*",
"phpdocumentor/phpdocumentor": "2.*",
"predis/predis": "1.0.*"
"predis/predis": "1.0.*",
"guzzlehttp/guzzle": "5.*",
"guzzlehttp/cache-subscriber": "0.1.*",
"zendframework/zend-serializer": "2.7.*"
},
"suggested": {
"predis/predis": "1.0.*"
"predis/predis": "1.0.*",
"guzzlehttp/guzzle": "5.*",
"guzzlehttp/cache-subscriber": "0.1.*"
},
"autoload": {
"psr-4": {
Expand Down
Loading