Skip to content

Commit e90344f

Browse files
committed
Merge branch 'master'
2 parents c87b2f5 + 909ccbc commit e90344f

File tree

4 files changed

+34
-7
lines changed

4 files changed

+34
-7
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@
22

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

5+
## [2.3.0] - 2017-10-06
6+
### Added
7+
- New `flush` method forces events to be published to the LaunchDarkly service. This can be useful if `LDClient` is not automatically destroyed at the end of a request. Thanks @foxted!
8+
9+
### Fixed
10+
- Documentation comment references the correct namespace for `CacheStorageInterface`. Thanks @pmeth!
11+
12+
## [2.2.0] - 2017-06-06
13+
### Added
14+
- Support for [publishing events via ld-relay](README.md#using-ld-relay)
15+
- Allow `EventPublisher` to be injected into the client.
16+
- `GuzzleEventPublisher` as a synchronous, in-process alternative to publishing events via background processes.
17+
- Allow the `curl` path used by `CurlEventPublisher` to be customized via the `curl` option to `LDClient`. Thanks @abacaphiliac!
18+
519
## [2.1.2] - 2017-04-27
620
### Changed
721
- Relaxed the requirement on `kevinrob/guzzle-cache-middleware` for the default `GuzzleFeatureRequester`.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.1.2
1+
2.3.0

src/LaunchDarkly/EventProcessor.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function __construct($sdkKey, $options = array()) {
1717
$this->_capacity = $options['capacity'];
1818
$this->_timeout = $options['timeout'];
1919

20-
$this->_queue = array();
20+
$this->_queue = array();
2121
}
2222

2323
public function __destruct() {
@@ -38,7 +38,11 @@ public function enqueue($event) {
3838
return true;
3939
}
4040

41-
protected function flush() {
41+
/**
42+
* Publish events to LaunchDarkly
43+
* @return bool Whether the events were successfully published
44+
*/
45+
public function flush() {
4246
if (empty($this->_queue)) {
4347
return null;
4448
}

src/LaunchDarkly/LDClient.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
class LDClient {
1212
const DEFAULT_BASE_URI = 'https://app.launchdarkly.com';
1313
const DEFAULT_EVENTS_URI = 'https://events.launchdarkly.com';
14-
const VERSION = '2.1.2';
14+
const VERSION = '2.3.0';
1515

1616
/** @var string */
1717
protected $_sdkKey;
@@ -41,7 +41,7 @@ class LDClient {
4141
* - events_uri: Base URI for sending events to LaunchDarkly. Defaults to 'https://events.launchdarkly.com'
4242
* - timeout: Float describing the maximum length of a request in seconds. Defaults to 3
4343
* - connect_timeout: Float describing the number of seconds to wait while trying to connect to a server. Defaults to 3
44-
* - cache: An optional Kevinrob\GuzzleCache\Strategy\CacheStorageInterface. Defaults to an in-memory cache.
44+
* - cache: An optional Kevinrob\GuzzleCache\Storage\CacheStorageInterface. Defaults to an in-memory cache.
4545
* - send_events: An optional bool that can disable the sending of events to LaunchDarkly. Defaults to false.
4646
* - logger: An optional Psr\Log\LoggerInterface. Defaults to a Monolog\Logger sending all messages to the php error_log.
4747
* - offline: An optional boolean which will disable all network calls and always return the default value. Defaults to false.
@@ -95,7 +95,7 @@ public function __construct($sdkKey, $options = array()) {
9595

9696
$this->_featureRequester = $this->getFeatureRequester($sdkKey, $options);
9797
}
98-
98+
9999
/**
100100
* @param string $sdkKey
101101
* @param mixed[] $options
@@ -106,7 +106,7 @@ private function getFeatureRequester($sdkKey, array $options)
106106
if (isset($options['feature_requester']) && $options['feature_requester'] instanceof FeatureRequester) {
107107
return $options['feature_requester'];
108108
}
109-
109+
110110
if (isset($options['feature_requester_class'])) {
111111
$featureRequesterClass = $options['feature_requester_class'];
112112
} else {
@@ -279,6 +279,15 @@ public function secureModeHash($user) {
279279
return hash_hmac("sha256", $user->getKey(), $this->_sdkKey, false);
280280
}
281281

282+
/**
283+
* Publish events to LaunchDarkly
284+
* @return bool Whether the events were successfully published
285+
*/
286+
public function flush()
287+
{
288+
return $this->_eventProcessor->flush();
289+
}
290+
282291
/**
283292
* @param $key string
284293
* @param $user LDUser

0 commit comments

Comments
 (0)