Skip to content

Backport v2 updates to php-5.3 branch #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Sep 27, 2016
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
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Change log

All notable changes to the LaunchDarkly Java SDK will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org).

## [2.0.0] - 2016-08-08
### Added
- Support for multivariate feature flags. In addition to booleans, feature flags can now return numbers, strings, dictionaries, or arrays via the `variation` method.
- New `allFlags` method returns all flag values for a specified user.
- New `secureModeHash` function computes a hash suitable for the new LaunchDarkly JavaScript client's secure mode feature.

### Changed
- The `FeatureRep` data model has been replaced with `FeatureFlag`. `FeatureFlag` is not generic.

### Deprecated
- The `toggle` call has been deprecated in favor of `variation`.

### Removed
- The `getFlag` function has been removed.
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Contributing to the LaunchDarkly SDK for PHP
================================================

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.
2 changes: 1 addition & 1 deletion LICENSE → LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2015 Catamorphic, Co.
Copyright 2016 Catamorphic, Co.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
46 changes: 41 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ 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:6.2.1"
php composer.phar require "kevinrob/guzzle-cache-middleware": "1.4.1"

1. After installing, require Composer's autoloader:

require 'vendor/autoload.php';

2. Create a new LDClient with your API key:
2. Create a new LDClient with your SDK key:

$client = new LaunchDarkly\LDClient("your_api_key");
$client = new LaunchDarkly\LDClient("your_sdk_key");

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

$user = new LaunchDarkly\LDUser("user@test.com");
if ($client->toggle("your.flag.key", $user)) {
if ($client->variation("your.flag.key", $user)) {
# application code to show the feature
} else {
# 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:6.2.1"
php composer.phar require "kevinrob/guzzle-cache-middleware": "1.4.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_sdk_key", ['feature_requester_class' => 'LaunchDarkly\LDDFeatureRequester']);

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

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).
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).

Testing
-------

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.

Contributing
------------

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.
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.

About LaunchDarkly
-----------
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.6.3
2.0.0
18 changes: 13 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
"launchdarkly",
"launchdarkly php"
],
"repositories": [
{
"type": "git",
"url": "https://github.com/launchdarkly/guzzle3.git"
}
],
"homepage": "https://github.com/launchdarkly/php-client",
"license": "Apache-2.0",
"authors": [
Expand All @@ -14,16 +20,18 @@
}
],
"require": {
"php": ">=5.4",
"guzzlehttp/guzzle": "5.*",
"guzzlehttp/cache-subscriber": "0.1.*"
"php": ">=5.3",
"guzzle/guzzle": "dev-master#ecb935d2d0ecd8cddae4dcfb90515cac5e2cb023",
"psr/log": "1.0.0"
},
"require-dev": {
"phpunit/phpunit": "4.3.*",
"phpunit/phpunit": "4.8.26",
"phpdocumentor/phpdocumentor": "2.*",
"predis/predis": "1.0.*"
"predis/predis": "1.0.*",
"zendframework/zend-serializer": "2.4.*"
},
"suggested": {
"monolog/monolog": "1.21.0",
"predis/predis": "1.0.*"
},
"autoload": {
Expand Down
Loading