Skip to content

Commit 3dbe415

Browse files
Merge pull request #121 from alphagov/SW-pr-119
Move to guzzle7-adapter
2 parents e756459 + 028a2e3 commit 3dbe415

File tree

5 files changed

+16
-38
lines changed

5 files changed

+16
-38
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## [5.0.0] - 2022-11-25
2+
### Removed
3+
4+
* Removed guzzle5-adapter and guzzle6-adapter documentation and support; this version now supports any PSR-7 compatible client library. Our documentation provides examples for using guzzle7.
5+
16
## [4.2.0] - 2022-09-27
27
### Added
38

DOCUMENTATION.md

+4-31
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ This documentation is for developers interested in using the GOV.UK Notify PHP c
44

55
## Set up the client
66

7-
The Notify PHP Client is based on a [PSR-7 HTTP model](https://www.php-fig.org/psr/psr-7/) [external link]. To install it, you must select your preferred PSR-7 compatible HTTP client. You can follow these instructions to use [Guzzle v6 and v5](http://docs.guzzlephp.org/en/stable/)[external link].
7+
The Notify PHP Client is based on a [PSR-7 HTTP model](https://www.php-fig.org/psr/psr-7/) [external link]. To install it, you must select your preferred PSR-7 compatible HTTP client. You can follow these instructions to use [Guzzle v7](https://docs.guzzlephp.org/en/7.0/)[external link].
88

9-
### Guzzle v6
9+
### Guzzle v7
1010

1111
1. Use [Composer](https://getcomposer.org/) [external link] to install the GOV.UK Notify PHP client. Run the following in the command line:
1212

1313
```sh
14-
composer require php-http/guzzle6-adapter alphagov/notifications-php-client
14+
composer require php-http/guzzle7-adapter alphagov/notifications-php-client
1515
```
1616

1717
You can now use the [autoloader](https://getcomposer.org/doc/01-basic-usage.md#autoloading) [external link] to download the GOV.UK Notify PHP client.
@@ -21,39 +21,12 @@ The Notify PHP Client is based on a [PSR-7 HTTP model](https://www.php-fig.org/p
2121
```
2222
$notifyClient = new \Alphagov\Notifications\Client([
2323
'apiKey' => '{your api key}',
24-
'httpClient' => new \Http\Adapter\Guzzle6\Client
24+
'httpClient' => new \Http\Adapter\Guzzle7\Client
2525
]);
2626
```
2727

2828
To get an API key, [sign in to GOV.UK Notify](https://www.notifications.service.gov.uk/sign-in) and go to the __API integration__ page. You can find more information in the [API keys](#api-keys) section of this documentation.
2929

30-
### Guzzle v5
31-
32-
1. Use [Composer](https://getcomposer.org/) [external link] to install the GOV.UK Notify PHP client. Run the following in the command line:
33-
34-
```sh
35-
composer require php-http/guzzle5-adapter php-http/message alphagov/notifications-php-client
36-
```
37-
38-
You can now use the [autoloader](https://getcomposer.org/doc/01-basic-usage.md#autoloading) [external link] to download the GOV.UK Notify PHP client.
39-
40-
1. Add the following code to your application to create a new instance of the client:
41-
42-
```
43-
$notifyClient = new \Alphagov\Notifications\Client([
44-
'apiKey' => '{your api key}',
45-
'httpClient' => new \Http\Adapter\Guzzle5\Client(
46-
new \GuzzleHttp\Client,
47-
new \Http\Message\MessageFactory\GuzzleMessageFactory
48-
),
49-
]);
50-
```
51-
52-
1. Run `$notifyClient` to access the GOV.UK Notify API.
53-
54-
To get an API key, [sign in to GOV.UK Notify](https://www.notifications.service.gov.uk/sign-in) and go to the __API integration__ page. You can find more information in the [API keys](#api-keys) section of this documentation.
55-
56-
5730
## Send a message
5831

5932
You can use GOV.UK Notify to send text messages, emails and letters.

composer.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@
1515
}
1616
],
1717
"require": {
18-
"php": "^7.1|^8.0",
18+
"php": "^7.2|^8.0",
1919
"firebase/php-jwt": "^v6.1.0",
20-
"guzzlehttp/psr7" : "^1.2"
20+
"guzzlehttp/psr7": "^2.1.1"
2121
},
2222
"require-dev": {
2323
"phpspec/phpspec": "^5.0|^7.2",
2424
"php-http/message": "^1.1",
2525
"php-http/mock-client": "*",
2626
"php-http/socket-client": "^2.1.0",
27-
"php-http/guzzle6-adapter": "*"
27+
"php-http/guzzle7-adapter": "^1.0"
2828
},
2929
"autoload": {
3030
"psr-4": {

spec/integration/ClientSpec.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function let(){
3232
$this->beConstructedWith([
3333
'baseUrl' => getenv('NOTIFY_API_URL'),
3434
'apiKey' => getenv('API_KEY'),
35-
'httpClient' => new \Http\Adapter\Guzzle6\Client
35+
'httpClient' => new \Http\Adapter\Guzzle7\Client
3636
]);
3737

3838
}
@@ -599,7 +599,7 @@ function it_receives_the_expected_response_when_sending_an_sms_notification_with
599599
$this->beConstructedWith([
600600
'baseUrl' => getenv('NOTIFY_API_URL'),
601601
'apiKey' => getenv('API_SENDING_KEY'),
602-
'httpClient' => new \Http\Adapter\Guzzle6\Client
602+
'httpClient' => new \Http\Adapter\Guzzle7\Client
603603
]);
604604

605605
$response = $this->sendSms(
@@ -729,7 +729,7 @@ function it_receives_the_expected_response_when_looking_up_received_texts() {
729729
$this->beConstructedWith([
730730
'baseUrl' => getenv('NOTIFY_API_URL'),
731731
'apiKey' => getenv('INBOUND_SMS_QUERY_KEY'),
732-
'httpClient' => new \Http\Adapter\Guzzle6\Client
732+
'httpClient' => new \Http\Adapter\Guzzle7\Client
733733
]);
734734

735735
$response = $this->listReceivedTexts();

src/Client.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Client {
2525
* @const string Current version of this client.
2626
* This follows Semantic Versioning (http://semver.org/)
2727
*/
28-
const VERSION = '4.2.0';
28+
const VERSION = '5.0.0';
2929

3030
/**
3131
* @const string The API endpoint for Notify production.

0 commit comments

Comments
 (0)