Skip to content

Commit 3895935

Browse files
prepare 4.1.0 release (#156)
1 parent ea665b4 commit 3895935

File tree

72 files changed

+1295
-899
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+1295
-899
lines changed

.circleci/config.yml

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
version: 2.1
22

3+
orbs:
4+
win: circleci/[email protected]
5+
36
workflows:
47
workflow:
58
jobs:
@@ -12,17 +15,53 @@ workflows:
1215
- test-with-preinstalled-php:
1316
name: PHP 8.0
1417
docker-image: cimg/php:8.0
18+
- test-on-windows
1519

1620
jobs:
21+
test-on-windows:
22+
executor:
23+
name: win/default
24+
shell: powershell.exe
25+
26+
environment:
27+
LD_INCLUDE_INTEGRATION_TESTS: 1
28+
29+
steps:
30+
- checkout
31+
- run:
32+
name: install php and java support
33+
command: choco install -y php composer javaruntime
34+
- run:
35+
name: download wiremock
36+
command: Invoke-WebRequest -Uri https://repo1.maven.org/maven2/com/github/tomakehurst/wiremock-jre8-standalone/2.31.0/wiremock-jre8-standalone-2.31.0.jar -UseBasicParsing -OutFile wiremock.jar
37+
- run:
38+
name: start wiremock
39+
background: true
40+
command: java -jar ./wiremock.jar
41+
- run:
42+
name: wait for wiremock to be available
43+
command: PowerShell -Command Start-Sleep -Seconds 5
44+
- run:
45+
name: install dependencies
46+
command: composer install --no-progress
47+
- run:
48+
name: run tests
49+
command: .\vendor\bin\phpunit
50+
1751
test-with-preinstalled-php:
1852
parameters:
1953
docker-image:
2054
type: string
2155

56+
environment:
57+
LD_INCLUDE_INTEGRATION_TESTS: 1
58+
2259
docker:
2360
- image: <<parameters.docker-image>>
61+
- image: wiremock/wiremock
2462

2563
steps:
64+
- setup_remote_docker
2665
- checkout
2766
- run:
2867
name: validate composer.json
@@ -33,13 +72,15 @@ jobs:
3372
- run:
3473
name: psalm linting
3574
command: ./vendor/bin/psalm --no-cache
36-
- run: mkdir -p ~/phpunit
75+
- run:
76+
name: php-cs-fixer check
77+
command: composer cs-check
3778
- run:
3879
name: run tests with highest compatible dependency versions
3980
command: php -d xdebug.mode=coverage vendor/bin/phpunit
4081
enviroment:
4182
XDEBUG_MODE: coverage
4283
- store_test_results:
43-
path: ~/phpunit
84+
path: build/phpunit
4485
- store_artifacts:
45-
path: ~/phpunit
86+
path: build/phpunit

.ldrelease/build-docs.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

.ldrelease/config.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
version: 2
2+
13
repo:
24
public: php-server-sdk
35
private: php-server-sdk-private
@@ -6,12 +8,13 @@ publications:
68
- url: https://packagist.org/packages/launchdarkly/server-sdk
79
description: Packagist
810

9-
circleci:
10-
linux:
11-
image: ldcircleci/php-sdk-release:1 # built in sdks-ci-docker project, contains PHP 7.3 + phpDocumentor 3
11+
jobs:
12+
- template:
13+
name: php
1214

1315
documentation:
14-
githubPages: true
16+
gitHubPages: true
17+
title: "LaunchDarkly PHP SDK"
1518

1619
sdk:
1720
displayName: "PHP"

.ldrelease/publish-docs.sh

Lines changed: 0 additions & 12 deletions
This file was deleted.

.php-cs-fixer.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()->in(__DIR__);
4+
5+
$config = new PhpCsFixer\Config();
6+
return $config
7+
->setFinder($finder)
8+
->setUsingCache(true)
9+
->setRules([
10+
'@PSR2' => true,
11+
'blank_line_after_opening_tag' => true,
12+
'ordered_imports' => true,
13+
'no_unused_imports' => true,
14+
'array_syntax' => ['syntax' => 'short'],
15+
]);

.php_cs

Lines changed: 0 additions & 10 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ The package name will also change. In the 3.5.3 release, it is still `launchdark
108108

109109
## [3.5.0] - 2019-01-30
110110
### Added:
111-
- It is now possible to use Consul or DynamoDB as a data store with `ld-relay`, similar to the existing Redis integration. See `LaunchDarkly\Integrations\Consul` and `LaunchDarkly\Integrations\DynamoDb`, and the reference guide [Using a persistent feature store](https://docs.launchdarkly.com/v2.0/docs/using-a-persistent-feature-store).
111+
- It is now possible to use Consul or DynamoDB as a data store with `ld-relay`, similar to the existing Redis integration. See `LaunchDarkly\Integrations\Consul` and `LaunchDarkly\Integrations\DynamoDb`, and the reference guide [Persistent data stores](https://docs.launchdarkly.com/sdk/concepts/data-stores).
112112
- When using the Redis integration, you can specify a Redis connection timeout different from the default of 5 seconds by setting the option `redis_timeout` to the desired number of seconds. (Thanks, [jjozefowicz](https://github.com/launchdarkly/php-client/pull/113)!)
113113
- It is now possible to inject feature flags into the client from local JSON files, replacing the normal LaunchDarkly connection. This would typically be for testing purposes. See `LaunchDarkly\Integrations\Files`.
114114
- The `allFlagsState` method now accepts a new option, `detailsOnlyForTrackedFlags`, which reduces the size of the JSON representation of the flag state by omitting some metadata. Specifically, it omits any data that is normally used for generating detailed evaluation events if a flag does not have event tracking or debugging turned on.
@@ -166,7 +166,7 @@ The package name will also change. In the 3.5.3 release, it is still `launchdark
166166

167167
## [2.4.0] - 2018-01-04
168168
### Added
169-
- Support for [private user attributes](https://docs.launchdarkly.com/docs/private-user-attributes).
169+
- Support for [private user attributes](https://docs.launchdarkly.com/home/users/attributes#creating-private-user-attributes).
170170

171171
### Changed
172172
- Stop retrying HTTP requests if the API key has been invalidated.

CONTRIBUTING.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Contributing to the LaunchDarkly Server-Side SDK for PHP
22

3-
LaunchDarkly has published an [SDK contributor's guide](https://docs.launchdarkly.com/docs/sdk-contributors-guide) that provides a detailed explanation of how our SDKs work. See below for additional information on how to contribute to this SDK.
3+
LaunchDarkly has published an [SDK contributor's guide](https://docs.launchdarkly.com/sdk/concepts/contributors-guide) that provides a detailed explanation of how our SDKs work. See below for additional information on how to contribute to this SDK.
44

55
## Submitting bug reports and feature requests
66

@@ -33,3 +33,9 @@ To run all unit tests:
3333
```
3434

3535
It is preferable to run tests against all supported minor versions of PHP (as described in `README.md` under Requirements), or at least the lowest and highest versions, prior to submitting a pull request. However, LaunchDarkly's CI tests will run automatically against all supported versions.
36+
37+
By default, this test suite does not include any integration test that relies on external dependencies. To include them, set the environment variable `LD_INCLUDE_INTEGRATION_TESTS=1` before running the tests. Note that you will also need an instance of [WireMock](http://wiremock.org/) for the tests to connect to. This can be run via docker as follows:
38+
39+
```
40+
docker run --rm -p 8080:8080 wiremock/wiremock
41+
```

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# LaunchDarkly Server-side SDK for PHP
22

33
[![Circle CI](https://img.shields.io/circleci/project/launchdarkly/php-server-sdk.png)](https://circleci.com/gh/launchdarkly/php-server-sdk)
4+
[![Packagist](https://img.shields.io/packagist/v/launchdarkly/server-sdk.svg?style=flat-square)](https://packagist.org/packages/launchdarkly/server-sdk)
5+
[![Documentation](https://img.shields.io/static/v1?label=GitHub+Pages&message=API+reference&color=00add8)](https://launchdarkly.github.io/php-server-sdk)
46

57
## LaunchDarkly overview
68

7-
[LaunchDarkly](https://www.launchdarkly.com) is a feature management platform that serves over 100 billion feature flags daily to help teams build better software, faster. [Get started](https://docs.launchdarkly.com/docs/getting-started) using LaunchDarkly today!
9+
[LaunchDarkly](https://www.launchdarkly.com) is a feature management platform that serves over 100 billion feature flags daily to help teams build better software, faster. [Get started](https://docs.launchdarkly.com/home/getting-started) using LaunchDarkly today!
810

911
[![Twitter Follow](https://img.shields.io/twitter/follow/launchdarkly.svg?style=social&label=Follow&maxAge=2592000)](https://twitter.com/intent/follow?screen_name=launchdarkly)
1012

@@ -37,7 +39,7 @@ We encourage pull requests and other contributions from the community. Check out
3739
* Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?).
3840
* Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file.
3941
* Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan). Disable parts of your application to facilitate maintenance, without taking everything offline.
40-
* LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Check out [our documentation](https://docs.launchdarkly.com/docs) for a complete list.
42+
* LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Read [our documentation](https://docs.launchdarkly.com/sdk) for a complete list.
4143
* Explore LaunchDarkly
4244
* [launchdarkly.com](https://www.launchdarkly.com/ "LaunchDarkly Main Website") for more information
4345
* [docs.launchdarkly.com](https://docs.launchdarkly.com/ "LaunchDarkly Documentation") for our documentation and SDK reference guides

VERSION

Lines changed: 0 additions & 1 deletion
This file was deleted.

build/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore

composer.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
"friendsofphp/php-cs-fixer": ">=2.2.19 <3.0",
2323
"guzzlehttp/guzzle": "^7",
2424
"kevinrob/guzzle-cache-middleware": "^3",
25-
"phpunit/phpunit": "^9",
2625
"phpunit/php-code-coverage": "^9",
27-
"vimeo/psalm": "^4.7"
26+
"phpunit/phpunit": "^9",
27+
"vimeo/psalm": "^4.0"
2828
},
2929
"suggest": {
3030
"guzzlehttp/guzzle": "(^7) Required when using GuzzleEventPublisher or the default FeatureRequester",
@@ -44,6 +44,7 @@
4444
"sort-packages": true
4545
},
4646
"scripts": {
47-
"cs": "vendor/bin/php-cs-fixer fix --diff --verbose"
47+
"cs-check": "vendor/bin/php-cs-fixer fix --diff --dry-run --verbose",
48+
"cs-fix": "vendor/bin/php-cs-fixer fix --diff --verbose"
4849
}
4950
}

docs/Makefile

Lines changed: 0 additions & 18 deletions
This file was deleted.

phpunit.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true" beStrictAboutChangesToGlobalState="true" beStrictAboutOutputDuringTests="true" beStrictAboutResourceUsageDuringSmallTests="true" beStrictAboutTestsThatDoNotTestAnything="true" beStrictAboutTodoAnnotatedTests="true" verbose="true" defaultTimeLimit="10">
33

44
<logging>
5-
<junit outputFile="~/phpunit/junit.xml"/>
5+
<junit outputFile="build/phpunit/junit.xml"/>
66
</logging>
77

88
<coverage>
99
<include>
1010
<directory suffix=".php">src</directory>
1111
</include>
1212
<report>
13-
<html outputDirectory="~/phpunit/html-coverage"/>
14-
<xml outputDirectory="~/phpunit/xml-coverage"/>
13+
<html outputDirectory="build/phpunit/html-coverage"/>
14+
<xml outputDirectory="build/phpunit/xml-coverage"/>
1515
</report>
1616
</coverage>
1717

psalm.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0"?>
22
<psalm
3-
errorLevel="4"
3+
errorLevel="2"
44
resolveFromConfigFile="true"
55
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
66
xmlns="https://getpsalm.org/schema/config"

src/LaunchDarkly/EvaluationDetail.php

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

33
namespace LaunchDarkly;
44

5-
use \LaunchDarkly\EvaluationReason;
6-
75
/**
86
* An object that combines the result of a flag evaluation with an explanation of how it was calculated.
97
*

src/LaunchDarkly/EvaluationReason.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ private function __construct(
166166
?int $ruleIndex = null,
167167
?string $ruleId = null,
168168
?string $prerequisiteKey = null,
169-
bool $inExperiment = false)
170-
{
169+
bool $inExperiment = false
170+
) {
171171
$this->_kind = $kind;
172172
$this->_errorKind = $errorKind;
173173
$this->_ruleIndex = $ruleIndex;
@@ -258,7 +258,7 @@ public function __toString(): string
258258
*/
259259
public function jsonSerialize(): array
260260
{
261-
$ret = array('kind' => $this->_kind);
261+
$ret = ['kind' => $this->_kind];
262262
if ($this->_errorKind !== null) {
263263
$ret['errorKind'] = $this->_errorKind;
264264
}

src/LaunchDarkly/EventPublisher.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace LaunchDarkly;
34

45
/**

0 commit comments

Comments
 (0)