Skip to content

Commit 40de1e4

Browse files
Replaced (deprecated) php-http/message-factory with psr/http-factory and
psr/http-client
1 parent 08d7ebd commit 40de1e4

43 files changed

Lines changed: 349 additions & 389 deletions

Some content is hidden

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

.github/workflows/build.yml

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,18 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
php: [8.3]
19+
php: [8.2]
2020
stability: [ prefer-stable ]
21-
symfony-version: [ '7.0.*' ]
21+
symfony-version: [ '7.3' ]
2222
include:
23-
- php: '8.1'
24-
symfony-version: 6.4.*
23+
- symfony-version: 6.4
24+
php: '8.1'
2525
stability: prefer-lowest
26-
- php: '8.1'
27-
symfony-version: 6.4.*
26+
- symfony-version: 6.4
27+
php: '8.1'
2828
stability: prefer-stable
29-
- php: '8.2'
30-
symfony-version: 6.4.*
31-
stability: prefer-stable
32-
- php: '8.2'
33-
symfony-version: 7.0.*
34-
stability: prefer-stable
35-
- php: '8.3'
36-
symfony-version: 7.0.*
37-
stability: prefer-stable
38-
- php: '8.4'
39-
symfony-version: 7.0.*
29+
- symfony-version: 7.3
30+
php: '8.4'
4031
stability: prefer-stable
4132

4233
env:

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGELOG
22

3+
### 7.0.0 (xxx)
4+
5+
* [PSR-17](https://www.php-fig.org/psr/psr-17/) and [PSR-18](https://www.php-fig.org/psr/psr-18/) implementation
6+
37
### 3.0.1 (2020-06-12)
48

59
* fixed issue #1 Nullable return type declaration fails with php 7.0

composer.json

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,28 @@
2121
"symfony/serializer": "^6.4 || ^7.0",
2222
"symfony/property-access": "^6.4 || ^7.0",
2323
"phpdocumentor/reflection-docblock": "^5.3",
24-
"php-http/message-factory": "^1.1"
24+
"psr/http-factory": "^1.1",
25+
"psr/http-client": "^1.0"
2526
},
2627
"require-dev": {
2728
"friendsofphp/php-cs-fixer": "^3.49",
2829
"php-http/cache-plugin": "^2.0",
29-
"php-http/guzzle7-adapter": "^1.0",
3030
"phpunit/phpunit": "^9.6.16",
3131
"phpunit/phpunit-selenium": "^9.0",
3232
"symfony/cache": "^6.4 || ^7.0",
33+
"symfony/http-client": "^6.4 || ^7.0",
3334
"symfony/phpunit-bridge": "^6.4 || ^7.0",
34-
"ext-json": "*"
35+
"ext-json": "*",
36+
"nyholm/psr7": "^1.8"
37+
},
38+
"scripts": {
39+
"test": "vendor/bin/phpunit -c phpunit.ci.xml"
3540
},
3641
"suggest": {
37-
"php-http/client-implementation": "Allows to use http services",
38-
"php-http/message": "Allows to use http services"
42+
"symfony/http-client": "For a fast PSR-18 client",
43+
"php-http/guzzle7-adapter": "For a widely used PSR-18 client",
44+
"nyholm/psr7": "Lightweight PSR-7/17 implementation",
45+
"php-http/discovery": "To auto-discover installed HTTP clients/factories"
3946
},
4047
"replace": {
4148
"egeloen/google-map": "^2.0.2"

doc/installation.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,17 @@ composer require ivory/google-map
1818

1919
## Download additional libraries
2020

21-
### Httplug
21+
### PSR-17 and PSR-18
2222

23-
If you want to use a service (geocoder, direction, ...), you will need an http client and message factory via
24-
[Httplug](http://httplug.io/) which is an http client abstraction library:
23+
If you want to use a service (geocoder, direction, ...), you will need an http client and request factory, this bundle is
24+
built around the [PSR-17](https://www.php-fig.org/psr/psr-17/) and [PSR-18](https://www.php-fig.org/psr/psr-18/) specifications.
25+
This means that any http client or request factory library which supports these specifications can be used within this bundle.
2526

2627
``` bash
27-
composer require php-http/guzzle7-adapter
28-
composer require php-http/message
28+
composer require symfony/http-client
2929
```
3030

31-
Here, I have chosen to use [Guzzle7](http://docs.guzzlephp.org/en/latest/psr7.html) but since Httplug supports the
32-
most popular http clients, you can install your preferred one instead.
31+
Here, I have chosen to use [HttpClient](https://github.com/symfony/http-client).
3332

3433
### Ivory Serializer
3534

doc/service/direction/direction.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,38 @@ or as latitude/longitude coordinates. The Direction API can return multi-part di
77

88
## Dependencies
99

10-
The Direction API requires an http client and so, the library relies on [Httplug](http://httplug.io/) which is an http
11-
client abstraction library. It also requires the [Ivory Serializer](https://github.com/egeloen/ivory-serializer) in
12-
order to deserialize the http response. To install them, read this [documentation](/doc/installation.md).
10+
The Direction API requires an (PSR-18) http client and (PSR-17) request factory. It also requires the
11+
[Ivory Serializer](https://github.com/egeloen/ivory-serializer) in order to deserialize the http response. To install
12+
them, read this [documentation](/doc/installation.md).
1313

1414
## Build
1515

1616
First of all, if you want to route a direction, you will need to build a direction service. So let's go:
1717

1818
``` php
1919
use Ivory\GoogleMap\Service\Direction\DirectionService;
20-
use Http\Adapter\Guzzle7\Client;
21-
use Http\Message\MessageFactory\GuzzleMessageFactory;
20+
use Symfony\Component\HttpClient\Psr18Client;
21+
use Nyholm\Psr7\Factory\Psr17Factory;
2222

23-
$direction = new DirectionService(new Client(), new GuzzleMessageFactory());
23+
$direction = new DirectionService(new Psr18Client(), new Psr17Factory());
2424
```
2525

26-
The direction constructor requires an `HttpClient` as first argument and a `MessageFactory` as second argument. Here,
27-
I have chosen to use the [Guzzle7](http://docs.guzzlephp.org/en/latest/psr7.html) client as well as the Guzzle message
28-
factory. Httplug supports the most popular http clients, so, you can choose you preferred one instead.
26+
The direction constructor requires an `HttpClient` as first argument and a `RequestFactory` as second argument. Here,
27+
I have chosen to use the [HttpClient](https://github.com/symfony/http-client) client as well as the
28+
[Psr7](https://github.com/Nyholm/psr7) request factory.
2929

3030
The direction constructor also accepts a `SerializerInterface` as third argument. It is highly recommended to use it
3131
in order to configure a PSR-6 cache pool and so avoid parsing the built-in metadata every time.
3232

3333
``` php
3434
use Ivory\GoogleMap\Service\Direction\DirectionService;
3535
use Ivory\GoogleMap\Service\Serializer\SerializerBuilder;
36-
use Http\Adapter\Guzzle7\Client;
37-
use Http\Message\MessageFactory\GuzzleMessageFactory;
36+
use Symfony\Component\HttpClient\Psr18Client;
37+
use Nyholm\Psr7\Factory\Psr17Factory;
3838

3939
$direction = new DirectionService(
40-
new Client(),
41-
new GuzzleMessageFactory(),
40+
new Psr18Client(),
41+
new Psr17Factory(),
4242
SerializerBuilder::create($psr6Pool)
4343
);
4444
```

doc/service/distance_matrix/distance_matrix.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,38 @@ single origin and destination to the [Direction API](/doc/service/direction/dire
99

1010
## Dependencies
1111

12-
The Distance Matrix API requires an http client and so, the library relies on [Httplug](http://httplug.io/) which is an
13-
http client abstraction library. It also requires the [Ivory Serializer](https://github.com/egeloen/ivory-serializer)
14-
in order to deserialize the http response. To install them, read this [documentation](/doc/installation.md).
12+
The Distance Matrix requires an (PSR-18) http client and (PSR-17) request factory. It also requires the
13+
[Ivory Serializer](https://github.com/egeloen/ivory-serializer) in order to deserialize the http response. To install
14+
them, read this [documentation](/doc/installation.md).
1515

1616
## Build
1717

1818
First of all, if you want to process a distance matrix, you will need to build a distance matrix service. So let's go:
1919

2020
``` php
2121
use Ivory\GoogleMap\Service\DistanceMatrix\DistanceMatrixService;
22-
use Http\Adapter\Guzzle7\Client;
23-
use Http\Message\MessageFactory\GuzzleMessageFactory;
22+
use Symfony\Component\HttpClient\Psr18Client;
23+
use Nyholm\Psr7\Factory\Psr17Factory;
2424

25-
$distanceMatrix = new DistanceMatrixService(new Client(), new GuzzleMessageFactory());
25+
$distanceMatrix = new DistanceMatrixService(new Psr18Client(), new Psr17Factory());
2626
```
2727

28-
The distance matrix constructor requires an `HttpClient` as first argument and a `MessageFactory` as second argument.
29-
Here, I have chosen to use the [Guzzle7](http://docs.guzzlephp.org/en/latest/psr7.html) client as well as the Guzzle
30-
message factory. Httplug supports the most popular http clients, so, you can choose you preferred one instead.
28+
The distance matrix constructor requires an `HttpClient` as first argument and a `RequestFactory` as second argument. Here,
29+
I have chosen to use the [HttpClient](https://github.com/symfony/http-client) client as well as the
30+
[Psr7](https://github.com/Nyholm/psr7) request factory.
3131

3232
The distance matrix constructor also accepts a `SerializerInterface` as third argument. It is highly recommended to
3333
use it in order to configure a PSR-6 cache pool and so avoid parsing the built-in metadata every time.
3434

3535
``` php
3636
use Ivory\GoogleMap\Service\DistanceMatrix\DistanceMatrixService;
3737
use Ivory\GoogleMap\Service\Serializer\SerializerBuilder;
38-
use Http\Adapter\Guzzle7\Client;
39-
use Http\Message\MessageFactory\GuzzleMessageFactory;
38+
use Symfony\Component\HttpClient\Psr18Client;
39+
use Nyholm\Psr7\Factory\Psr17Factory;
4040

4141
$distanceMatrix = new DistanceMatrixService(
42-
new Client(),
43-
new GuzzleMessageFactory(),
42+
new Psr18Client(),
43+
new Psr17Factory(),
4444
SerializerBuilder::create($psr6Pool)
4545
);
4646
```

doc/service/elevation/elevation.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,38 +6,38 @@ routes.
66

77
## Dependencies
88

9-
The Elevation API requires an http client and so, the library relies on [Httplug](http://httplug.io/) which is an http
10-
client abstraction library. It also requires the [Ivory Serializer](https://github.com/egeloen/ivory-serializer) in
11-
order to deserialize the http response. To install them, read this [documentation](/doc/installation.md).
9+
The Elevation API requires an (PSR-18) http client and (PSR-17) request factory. It also requires the
10+
[Ivory Serializer](https://github.com/egeloen/ivory-serializer) in order to deserialize the http response. To install
11+
them, read this [documentation](/doc/installation.md).
1212

1313
## Build
1414

1515
First of all, if you want to process an elevation, you will need to build an elevation service. So let's go:
1616

1717
``` php
1818
use Ivory\GoogleMap\Service\Elevation\ElevationService;
19-
use Http\Adapter\Guzzle7\Client;
20-
use Http\Message\MessageFactory\GuzzleMessageFactory;
19+
use Symfony\Component\HttpClient\Psr18Client;
20+
use Nyholm\Psr7\Factory\Psr17Factory;
2121

22-
$elevation = new ElevationService(new Client(), new GuzzleMessageFactory());
22+
$elevation = new ElevationService(new Psr18Client(), new Psr17Factory());
2323
```
2424

25-
The elevation constructor requires an `HttpClient` as first argument and a `MessageFactory` as second argument.
26-
Here, I have chosen to use the [Guzzle7](http://docs.guzzlephp.org/en/latest/psr7.html) client as well as the Guzzle
27-
message factory. Httplug supports the most popular http clients, so, you can choose you preferred one instead.
25+
The elevation constructor requires an `HttpClient` as first argument and a `RequestFactory` as second argument. Here,
26+
I have chosen to use the [HttpClient](https://github.com/symfony/http-client) client as well as the
27+
[Psr7](https://github.com/Nyholm/psr7) request factory.
2828

2929
The elevation constructor also accepts a `SerializerInterface` as third argument. It is highly recommended to use it in
3030
order to configure a PSR-6 cache pool and so avoid parsing the built-in metadata every time.
3131

3232
``` php
3333
use Ivory\GoogleMap\Service\Elevation\ElevationService;
3434
use Ivory\GoogleMap\Service\Serializer\SerializerBuilder;
35-
use Http\Adapter\Guzzle7\Client;
36-
use Http\Message\MessageFactory\GuzzleMessageFactory;
35+
use Symfony\Component\HttpClient\Psr18Client;
36+
use Nyholm\Psr7\Factory\Psr17Factory;
3737

3838
$elevation = new ElevationService(
39-
new Client(),
40-
new GuzzleMessageFactory(),
39+
new Psr18Client(),
40+
new Psr17Factory(),
4141
SerializerBuilder::create($psr6Pool)
4242
);
4343
```

doc/service/geocoder/geocoder.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,38 @@ process is known as "reverse geocoding".
77

88
## Dependencies
99

10-
The Geocoder API requires an http client and so, the library relies on [Httplug](http://httplug.io/) which is an http
11-
client abstraction library. It also requires the [Ivory Serializer](https://github.com/egeloen/ivory-serializer) in
12-
order to deserialize the http response. To install them, read this [documentation](/doc/installation.md).
10+
The Geocoder API requires an (PSR-18) http client and (PSR-17) request factory. It also requires the
11+
[Ivory Serializer](https://github.com/egeloen/ivory-serializer) in order to deserialize the http response. To install
12+
them, read this [documentation](/doc/installation.md).
1313

1414
## Build
1515

1616
First of all, if you want to geocode a position, you will need to build a geocoder provider. So let's go:
1717

1818
``` php
1919
use Ivory\GoogleMap\Service\Geocoder\GeocoderService;
20-
use Http\Adapter\Guzzle7\Client;
21-
use Http\Message\MessageFactory\GuzzleMessageFactory;
20+
use Symfony\Component\HttpClient\Psr18Client;
21+
use Nyholm\Psr7\Factory\Psr17Factory;
2222

23-
$geocoder = new GeocoderService(new Client(), new GuzzleMessageFactory());
23+
$geocoder = new GeocoderService(new Psr18Client(), new Psr17Factory());
2424
```
2525

26-
The geocoder constructor requires an `HttpClient` as first argument and a `MessageFactory` as second argument. Here,
27-
I have chosen to use the [Guzzle7](http://docs.guzzlephp.org/en/latest/psr7.html) client as well as the Guzzle message
28-
factory. Httplug supports the most popular http clients, so, you can choose you preferred one instead.
26+
The geocoder constructor requires an `HttpClient` as first argument and a `RequestFactory` as second argument. Here,
27+
I have chosen to use the [HttpClient](https://github.com/symfony/http-client) client as well as the
28+
[Psr7](https://github.com/Nyholm/psr7) request factory.
2929

3030
The geocoder constructor also accepts a `SerializerInterface` as third argument. It is highly recommended to use it in
3131
order to configure a PSR-6 cache pool and so avoid parsing the built-in metadata every time.
3232

3333
``` php
3434
use Ivory\GoogleMap\Service\Geocoder\GeocoderService;
3535
use Ivory\GoogleMap\Service\Serializer\SerializerBuilder;
36-
use Http\Adapter\Guzzle7\Client;
37-
use Http\Message\MessageFactory\GuzzleMessageFactory;
36+
use Symfony\Component\HttpClient\Psr18Client;
37+
use Nyholm\Psr7\Factory\Psr17Factory;
3838

3939
$geocoder = new GeocoderService(
40-
new Client(),
41-
new GuzzleMessageFactory(),
40+
new Psr18Client(),
41+
new Psr17Factory(),
4242
SerializerBuilder::create($psr6Pool)
4343
);
4444
```

doc/service/place/autocomplete/place_autocomplete.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ request for more information about any of the places which are returned.
1212

1313
## Dependencies
1414

15-
The Place Autocomplete API requires an http client and so, the library relies on [Httplug](http://httplug.io/) which is
16-
an http client abstraction library. It also requires the [Ivory Serializer](https://github.com/egeloen/ivory-serializer)
17-
in order to deserialize the http response. To install them, read this [documentation](/doc/installation.md).
15+
The Place Autocomplete API requires an (PSR-18) http client and (PSR-17) request factory. It also requires the
16+
[Ivory Serializer](https://github.com/egeloen/ivory-serializer) in order to deserialize the http response. To install
17+
them, read this [documentation](/doc/installation.md).
1818

1919
## Build
2020

@@ -23,28 +23,28 @@ let's go:
2323

2424
``` php
2525
use Ivory\GoogleMap\Service\Direction\Place\Autocomplete\PlaceAutocompleteService;
26-
use Http\Adapter\Guzzle7\Client;
27-
use Http\Message\MessageFactory\GuzzleMessageFactory;
26+
use Symfony\Component\HttpClient\Psr18Client;
27+
use Nyholm\Psr7\Factory\Psr17Factory;
2828

29-
$autocomplete = new PlaceAutocompleteService(new Client(), new GuzzleMessageFactory());
29+
$autocomplete = new PlaceAutocompleteService(new Psr18Client(), new Psr17Factory());
3030
```
3131

32-
The Place Autocomplete constructor requires an `HttpClient` as first argument and a `MessageFactory` as second argument.
33-
Here, I have chosen to use the [Guzzle7](http://docs.guzzlephp.org/en/latest/psr7.html) client as well as the Guzzle
34-
message factory. Httplug supports the most popular http clients, so, you can choose you preferred one instead.
32+
The direction constructor requires an `HttpClient` as first argument and a `RequestFactory` as second argument. Here,
33+
I have chosen to use the [HttpClient](https://github.com/symfony/http-client) client as well as the
34+
[Psr7](https://github.com/Nyholm/psr7) request factory.
3535

3636
The Place Autocomplete constructor also accepts a `SerializerInterface` as third argument. It is highly recommended to
3737
use it in order to configure a PSR-6 cache pool and so avoid parsing the built-in metadata every time.
3838

3939
``` php
4040
use Ivory\GoogleMap\Service\Place\Autocomplete\PlaceAutocompleteService;
4141
use Ivory\GoogleMap\Service\Serializer\SerializerBuilder;
42-
use Http\Adapter\Guzzle7\Client;
43-
use Http\Message\MessageFactory\GuzzleMessageFactory;
42+
use Symfony\Component\HttpClient\Psr18Client;
43+
use Nyholm\Psr7\Factory\Psr17Factory;
4444

4545
$autocomplete = new PlaceAutocompleteService(
46-
new Client(),
47-
new GuzzleMessageFactory(),
46+
new Psr18Client(),
47+
new Psr17Factory(),
4848
SerializerBuilder::create($psr6Pool)
4949
);
5050
```

0 commit comments

Comments
 (0)