Skip to content

Commit 605b3ef

Browse files
Bump minimum PHP version to 7.2 (#250)
* Package now requires PHP 7.2 or higher * Changed dev dependency from Guzzle Adapter to straight Guzzle 7 * Drop PHP 7.1 from testing matrix * Updated documentation
1 parent 0e2a1d8 commit 605b3ef

File tree

5 files changed

+13
-7
lines changed

5 files changed

+13
-7
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
- ubuntu-latest
77
strategy:
88
matrix:
9-
php: ['7.1', '7.2', '7.3', '7.4']
9+
php: ['7.2', '7.3', '7.4']
1010
steps:
1111
- name: Configure Git
1212
if: ${{ matrix.os == 'windows-latest' }}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ curl.cainfo = "C:\php\extras\ssl\cacert.pem"
669669

670670
### Pass custom HTTP client
671671

672-
We allow use of any HTTPlug adapter, so you can create a client with alternative configuration if you need it, for example to take account of a local proxy, or deal with something else specific to your setup.
672+
We allow use of any HTTPlug adapter or PSR-18 compatible HTTP client, so you can create a client with alternative configuration if you need it, for example to take account of a local proxy, or deal with something else specific to your setup.
673673

674674
Here's an example that reduces the default timeout to 5 seconds to avoid long delays if you have no route to our servers:
675675

@@ -684,7 +684,7 @@ When things go wrong, you'll receive an `Exception`. The Vonage exception classe
684684

685685
### Composer installation fails due to Guzzle Adapter
686686

687-
If you have a conflicting package installation that cannot co-exist with our recommended `php-http/guzzle6-adapter` package, then you may install the package `vonage/client-core` along with any package that satisfies the `php-http/client-implementation` requirement.
687+
If you have a conflicting package installation that cannot co-exist with our recommended `guzzlehttp/guzzle` package, then you may install the package `vonage/client-core` along with any package that satisfies the `php-http/client-implementation` requirement.
688688

689689
See the [Packagist page for client-implementation](https://packagist.org/providers/php-http/client-implementation) for options.
690690

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"email": "[email protected]"
3131
},
3232
"require": {
33-
"php": ">=7.1",
33+
"php": ">=7.2",
3434
"psr/http-client-implementation": "^1.0",
3535
"laminas/laminas-diactoros": "^1.8.4 || ^2.0",
3636
"lcobucci/jwt": "^3.2",
@@ -43,7 +43,7 @@
4343
"php-http/mock-client": "^1.4",
4444
"estahn/phpunit-json-assertions": "^3.0.0",
4545
"squizlabs/php_codesniffer": "^3.1",
46-
"php-http/guzzle6-adapter": "^2.0",
46+
"guzzlehttp/guzzle": "^7.0",
4747
"phpstan/phpstan": "^0.12.11"
4848
},
4949
"autoload": {

src/Client.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,13 @@ class Client
7777
public function __construct(CredentialsInterface $credentials, $options = array(), ClientInterface $client = null)
7878
{
7979
if (is_null($client)) {
80-
$client = new \Http\Adapter\Guzzle6\Client();
80+
// Since the user did not pass a client, try and make a client
81+
// using the Guzzle 6 adapter or Guzzle 7
82+
if (class_exists(\Http\Adapter\Guzzle6\Client::class)) {
83+
$client = new \Http\Adapter\Guzzle6\Client();
84+
} elseif (class_exists(\GuzzleHttp\Client::class)) {
85+
$client = new \GuzzleHttp\Client();
86+
}
8187
}
8288

8389
$this->setHttpClient($client);

test/ClientTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace VonageTest;
1010

11-
use Http\Adapter\Guzzle6\Client as HttpClient;
11+
use GuzzleHttp\Client as HttpClient;
1212
use Http\Message\MessageFactory\DiactorosMessageFactory;
1313
use Http\Mock\Client as HttpMock;
1414
use Vonage\Client;

0 commit comments

Comments
 (0)