diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a107f9e..6fdd144b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" betwee ## Unreleased +### Changed + +- Allow version 2 of `php-http/client-common` + ### Fixed - Fix deprecated notice when using symfony/config > 4.2 diff --git a/DependencyInjection/HttplugExtension.php b/DependencyInjection/HttplugExtension.php index c88e2849..ca56b410 100644 --- a/DependencyInjection/HttplugExtension.php +++ b/DependencyInjection/HttplugExtension.php @@ -3,8 +3,10 @@ namespace Http\HttplugBundle\DependencyInjection; use Http\Client\Common\BatchClient; +use Http\Client\Common\BatchClientImpl; use Http\Client\Common\FlexibleHttpClient; use Http\Client\Common\HttpMethodsClient; +use Http\Client\Common\HttpMethodsClientImpl; use Http\Client\Common\Plugin\AuthenticationPlugin; use Http\Client\Common\PluginClient; use Http\Client\Common\PluginClientFactory; @@ -362,8 +364,9 @@ function ($id) { } if ($arguments['http_methods_client']) { + $fqn = class_exists(HttpMethodsClientImpl::class) ? HttpMethodsClientImpl::class : HttpMethodsClient::class; $container - ->register($serviceId.'.http_methods', HttpMethodsClient::class) + ->register($serviceId.'.http_methods', $fqn) ->setArguments([new Reference($serviceId.'.http_methods.inner'), new Reference('httplug.message_factory')]) ->setPublic($arguments['public'] ? true : false) ->setDecoratedService($serviceId) @@ -371,8 +374,9 @@ function ($id) { } if ($arguments['batch_client']) { + $fqn = class_exists(BatchClientImpl::class) ? BatchClientImpl::class : BatchClient::class; $container - ->register($serviceId.'.batch_client', BatchClient::class) + ->register($serviceId.'.batch_client', $fqn) ->setArguments([new Reference($serviceId.'.batch_client.inner')]) ->setPublic($arguments['public'] ? true : false) ->setDecoratedService($serviceId) diff --git a/composer.json b/composer.json index 6862b1a4..fc7748d0 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ ], "require": { "php": "^5.5 || ^7.0", - "php-http/client-common": "^1.6", + "php-http/client-common": "^1.6 || ^2.0", "php-http/client-implementation": "^1.0", "php-http/cache-plugin": "^1.4", "php-http/discovery": "^1.0",