Skip to content

Commit e1261dd

Browse files
authored
Merge pull request #40 from launchdarkly/jko/php-5.3-v2
Backport v2 updates to php-5.3 branch
2 parents 7a1f041 + c86fa3d commit e1261dd

29 files changed

+2033
-1156
lines changed

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Change log
2+
3+
All notable changes to the LaunchDarkly Java SDK will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org).
4+
5+
## [2.0.0] - 2016-08-08
6+
### Added
7+
- Support for multivariate feature flags. In addition to booleans, feature flags can now return numbers, strings, dictionaries, or arrays via the `variation` method.
8+
- New `allFlags` method returns all flag values for a specified user.
9+
- New `secureModeHash` function computes a hash suitable for the new LaunchDarkly JavaScript client's secure mode feature.
10+
11+
### Changed
12+
- The `FeatureRep` data model has been replaced with `FeatureFlag`. `FeatureFlag` is not generic.
13+
14+
### Deprecated
15+
- The `toggle` call has been deprecated in favor of `variation`.
16+
17+
### Removed
18+
- The `getFlag` function has been removed.

CONTRIBUTING.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Contributing to the LaunchDarkly SDK for PHP
2+
================================================
3+
4+
We encourage pull-requests and other contributions from the community. We've also published an [SDK contributor's guide](http://docs.launchdarkly.com/v1.0/docs/sdk-contributors-guide) that provides a detailed explanation of how our SDKs work.

LICENSE renamed to LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2015 Catamorphic, Co.
1+
Copyright 2016 Catamorphic, Co.
22

33
Licensed under the Apache License, Version 2.0 (the "License");
44
you may not use this file except in compliance with the License.

README.md

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@ Quick setup
1111
0. Install the PHP SDK with [Composer](https://getcomposer.org/)
1212

1313
php composer.phar require launchdarkly/launchdarkly-php
14+
php composer.phar require "guzzlehttp/guzzle:6.2.1"
15+
php composer.phar require "kevinrob/guzzle-cache-middleware": "1.4.1"
1416

1517
1. After installing, require Composer's autoloader:
1618

1719
require 'vendor/autoload.php';
1820

19-
2. Create a new LDClient with your API key:
21+
2. Create a new LDClient with your SDK key:
2022

21-
$client = new LaunchDarkly\LDClient("your_api_key");
23+
$client = new LaunchDarkly\LDClient("your_sdk_key");
2224

2325
Your first feature flag
2426
-----------------------
@@ -28,21 +30,55 @@ Your first feature flag
2830
2. In your application code, use the feature's key to check whether the flag is on for each user:
2931

3032
$user = new LaunchDarkly\LDUser("user@test.com");
31-
if ($client->toggle("your.flag.key", $user)) {
33+
if ($client->variation("your.flag.key", $user)) {
3234
# application code to show the feature
3335
} else {
3436
# the code to run if the feature is off
3537
}
3638

39+
Fetching flags
40+
--------------
41+
42+
There are two approaches to fetching the flag rules from LaunchDarkly:
43+
44+
* Making HTTP requests (using Guzzle)
45+
* Setting up the [ld-daemon](https://github.com/launchdarkly/ld-daemon) to store the flags in Redis
46+
47+
Using Guzzle
48+
============
49+
50+
To use Guzzle it must be required as a dependency:
51+
52+
php composer.phar require "guzzlehttp/guzzle:6.2.1"
53+
php composer.phar require "kevinrob/guzzle-cache-middleware": "1.4.1"
54+
55+
It will then be used as the default way of fetching flags.
56+
57+
Using Redis
58+
===========
59+
60+
1. Require Predis as a dependency:
61+
62+
php composer.phar require "predis/predis:1.0.*"
63+
64+
2. Create the LDClient with the Redis feature requester as an option:
65+
66+
$client = new LaunchDarkly\LDClient("your_sdk_key", ['feature_requester_class' => 'LaunchDarkly\LDDFeatureRequester']);
67+
3768
Learn more
3869
-----------
3970

40-
Check out our [documentation](http://docs.launchdarkly.com) for in-depth instructions on configuring and using LaunchDarkly. You can also head straight to the [complete reference guide for this SDK](http://docs.launchdarkly.com/v1.0/docs/php-sdk-reference).
71+
Check out our [documentation](http://docs.launchdarkly.com) for in-depth instructions on configuring and using LaunchDarkly. You can also head straight to the [complete reference guide for this SDK](http://docs.launchdarkly.com/docs/php-sdk-reference).
72+
73+
Testing
74+
-------
75+
76+
We run integration tests for all our SDKs using a centralized test harness. This approach gives us the ability to test for consistency across SDKs, as well as test networking behavior in a long-running application. These tests cover each method in the SDK, and verify that event sending, flag evaluation, stream reconnection, and other aspects of the SDK all behave correctly.
4177

4278
Contributing
4379
------------
4480

45-
We encourage pull-requests and other contributions from the community. We've also published an [SDK contributor's guide](http://docs.launchdarkly.com/v1.0/docs/sdk-contributors-guide) that provides a detailed explanation of how our SDKs work.
81+
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.
4682

4783
About LaunchDarkly
4884
-----------

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.6.3
1+
2.0.0

composer.json

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
"launchdarkly",
66
"launchdarkly php"
77
],
8+
"repositories": [
9+
{
10+
"type": "git",
11+
"url": "https://github.com/launchdarkly/guzzle3.git"
12+
}
13+
],
814
"homepage": "https://github.com/launchdarkly/php-client",
915
"license": "Apache-2.0",
1016
"authors": [
@@ -14,16 +20,18 @@
1420
}
1521
],
1622
"require": {
17-
"php": ">=5.4",
18-
"guzzlehttp/guzzle": "5.*",
19-
"guzzlehttp/cache-subscriber": "0.1.*"
23+
"php": ">=5.3",
24+
"guzzle/guzzle": "dev-master#ecb935d2d0ecd8cddae4dcfb90515cac5e2cb023",
25+
"psr/log": "1.0.0"
2026
},
2127
"require-dev": {
22-
"phpunit/phpunit": "4.3.*",
28+
"phpunit/phpunit": "4.8.26",
2329
"phpdocumentor/phpdocumentor": "2.*",
24-
"predis/predis": "1.0.*"
30+
"predis/predis": "1.0.*",
31+
"zendframework/zend-serializer": "2.4.*"
2532
},
2633
"suggested": {
34+
"monolog/monolog": "1.21.0",
2735
"predis/predis": "1.0.*"
2836
},
2937
"autoload": {

0 commit comments

Comments
 (0)