From 479cb07062e462b65b23f72e2fea27bf6a67c184 Mon Sep 17 00:00:00 2001 From: Eli Bishop Date: Wed, 15 Jun 2022 10:20:39 -0700 Subject: [PATCH 1/2] bump Consul client dependency to 5.x in new major version --- .ldrelease/config.yml | 1 + README.md | 6 +++--- composer.json | 2 +- .../Impl/Integrations/ConsulFeatureRequester.php | 7 +++---- tests/ConsulFeatureRequesterTest.php | 7 +++---- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/.ldrelease/config.yml b/.ldrelease/config.yml index f43e455..8c2cefa 100644 --- a/.ldrelease/config.yml +++ b/.ldrelease/config.yml @@ -12,6 +12,7 @@ jobs: branches: - name: main + - name: 2.x - name: 1.x documentation: diff --git a/README.md b/README.md index b1dfb87..0c92380 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,11 @@ [![CircleCI](https://circleci.com/gh/launchdarkly/php-server-sdk-consul.svg?style=svg)](https://circleci.com/gh/launchdarkly/php-server-sdk-consul) -This library provides a [Consul](https://www.consul.io/)-backed data source for the [LaunchDarkly PHP SDK](https://github.com/launchdarkly/php-server-sdk), replacing the default behavior of querying the LaunchDarkly service endpoints. The underlying Consul client implementation is the [`sensiolabs/consul-php-sdk`](https://github.com/FriendsOfPHP/consul-php-sdk) package. +This library provides a [Consul](https://www.consul.io/)-backed data source for the [LaunchDarkly PHP SDK](https://github.com/launchdarkly/php-server-sdk), replacing the default behavior of querying the LaunchDarkly service endpoints. The underlying Consul client implementation is the [`friendsofphp/consul-php-sdk`](https://github.com/FriendsOfPHP/consul-php-sdk) package. The minimum version of the LaunchDarkly PHP SDK for use with this library is 4.0.0. In earlier versions of the SDK, the Consul integration was bundled in the main SDK package. -This version of the package uses version 4.x of the `consul-php-sdk` client. If your application needs to use an earlier version of `consul-php-sdk`, use a 1.x version of `launchdarkly/server-sdk-consul`. +This version of the package uses version 5.x of the `consul-php-sdk` client. If your application needs to use an earlier version of `consul-php-sdk`, use `launchdarkly/server-sdk-consul` 1.x (for version 2.x of `consul-php-sdk`) or `launchdarkly/server-sdk-consul` 2.x (for version 4.x of `consul-php-sdk`). The minimum PHP version is 7.3. @@ -22,7 +22,7 @@ This assumes that you have already installed the LaunchDarkly PHP SDK in your pr php composer.phar install launchdarkly/server-sdk-consul --save ``` -If your project does not already have a dependency on `sensiolabs/consul-php-sdk`, that package will be loaded automatically as a dependency of `launchdarkly/server-sdk-consul`. +If your project does not already have a dependency on `friendsofphp/consul-php-sdk`, that package will be loaded automatically as a dependency of `launchdarkly/server-sdk-consul`. 3. In your SDK configuration code, configure the Consul integration: diff --git a/composer.json b/composer.json index a395f51..16e9728 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ ], "require": { "php": ">=7.3", - "sensiolabs/consul-php-sdk": "^4", + "friendsofphp/consul-php-sdk": "^5", "launchdarkly/server-sdk": "^4" }, "require-dev": { diff --git a/src/LaunchDarkly/Impl/Integrations/ConsulFeatureRequester.php b/src/LaunchDarkly/Impl/Integrations/ConsulFeatureRequester.php index 71c7c19..2a4c81e 100644 --- a/src/LaunchDarkly/Impl/Integrations/ConsulFeatureRequester.php +++ b/src/LaunchDarkly/Impl/Integrations/ConsulFeatureRequester.php @@ -2,8 +2,8 @@ namespace LaunchDarkly\Impl\Integrations; use LaunchDarkly\Impl\Integrations\FeatureRequesterBase; -use SensioLabs\Consul\Exception\ClientException; -use SensioLabs\Consul\ServiceFactory; +use Consul\Exception\ClientException; +use Consul\Services\KV; /** * @internal @@ -23,8 +23,7 @@ public function __construct($baseUri, $sdkKey, $options) if (isset($options['consul_uri'])) { $consulOpts['base_uri'] = $options['consul_uri']; } - $sf = new ServiceFactory($consulOpts); - $this->_kvClient = $sf->get('kv'); + $this->_kvClient = new KV(); $prefix = $options['consul_prefix'] ?? null; if ($prefix === null || $prefix === '') { diff --git a/tests/ConsulFeatureRequesterTest.php b/tests/ConsulFeatureRequesterTest.php index ddea0e7..8870822 100644 --- a/tests/ConsulFeatureRequesterTest.php +++ b/tests/ConsulFeatureRequesterTest.php @@ -5,8 +5,8 @@ use LaunchDarkly\FeatureRequester; use LaunchDarkly\Integrations\Consul; use LaunchDarkly\SharedTest\DatabaseFeatureRequesterTestBase; -use SensioLabs\Consul\Exception\ClientException; -use SensioLabs\Consul\ServiceFactory; +use Consul\Exception\ClientException; +use Consul\Services\KV; class ConsulFeatureRequesterTest extends DatabaseFeatureRequesterTestBase { @@ -14,8 +14,7 @@ class ConsulFeatureRequesterTest extends DatabaseFeatureRequesterTestBase public static function setUpBeforeClass(): void { - $sf = new ServiceFactory(); - self::$kvClient = $sf->get('kv'); + self::$kvClient = new KV(); } private static function realPrefix(?string $prefix): string From 9bebaf86fb52b2ceee6315149058e3bc660a1de8 Mon Sep 17 00:00:00 2001 From: Eli Bishop Date: Wed, 15 Jun 2022 11:58:05 -0700 Subject: [PATCH 2/2] PHP 7.3 is EOL --- .circleci/config.yml | 3 --- README.md | 2 +- composer.json | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b78de18..2d23a44 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,9 +3,6 @@ version: 2.1 workflows: workflow: jobs: - - linux-test: - name: PHP 7.3 - docker-image: cimg/php:7.3 - linux-test: name: PHP 7.4 docker-image: cimg/php:7.4 diff --git a/README.md b/README.md index 0c92380..de12711 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ The minimum version of the LaunchDarkly PHP SDK for use with this library is 4.0 This version of the package uses version 5.x of the `consul-php-sdk` client. If your application needs to use an earlier version of `consul-php-sdk`, use `launchdarkly/server-sdk-consul` 1.x (for version 2.x of `consul-php-sdk`) or `launchdarkly/server-sdk-consul` 2.x (for version 4.x of `consul-php-sdk`). -The minimum PHP version is 7.3. +The minimum PHP version is 7.4. For more information, see [our SDK documentation](https://docs.launchdarkly.com/sdk/features/storing-data). diff --git a/composer.json b/composer.json index 16e9728..dadd70b 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ } ], "require": { - "php": ">=7.3", + "php": ">=7.4", "friendsofphp/consul-php-sdk": "^5", "launchdarkly/server-sdk": "^4" },