Skip to content

Commit 7d2fb70

Browse files
Update to support ivory-google-map refactor regarding psr/http* packages
1 parent eab0385 commit 7d2fb70

64 files changed

Lines changed: 213 additions & 307 deletions

File tree

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+
* updated to support `ivory/google-map:7.0`, full PSR-17 and PSR-18 compatibility
6+
37
### 3.0.4 (2020-06-13)
48

59
* updated documentation

DependencyInjection/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ private function createServiceNode(string $service, bool $http): ArrayNodeDefini
8686
->isRequired()
8787
->cannotBeEmpty()
8888
->end()
89-
->scalarNode('message_factory')
89+
->scalarNode('request_factory')
9090
->isRequired()
9191
->cannotBeEmpty()
9292
->end()

DependencyInjection/IvoryGoogleMapExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ private function loadServiceConfig(
141141
if ($http) {
142142
$definition
143143
->addArgument(new Reference($config['client']))
144-
->addArgument(new Reference($config['message_factory']));
144+
->addArgument(new Reference($config['request_factory']));
145145
}
146146

147147
if ($http && isset($config['format'])) {

Resources/doc/installation.md

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,20 @@ $ composer require ivory/google-map-bundle
2626
If you want to use the [Direction](/Resources/doc/service/direction.md),
2727
[Distance Matrix](/Resources/doc/service/distance_matrix.md), [Elevation](/Resources/doc/service/elevation.md),
2828
[Geocoder](/Resources/doc/service/geocoder.md), [Place](/Resources/doc/service/place/index.md) or
29-
[Time Zone](/Resources/doc/service/time_zone.md) services, you will need an http client and message factory via
30-
[Httplug](https://httplug.io/) which is an http client abstraction library as well as the
31-
[Ivory Serializer](https://github.com/egeloen/ivory-serializer) which is an advanced (de)-serialization library.
29+
[Time Zone](/Resources/doc/service/time_zone.md) services, you will need an [PSR-18](https://www.php-fig.org/psr/psr-18/)
30+
http client and [PSR-17](https://www.php-fig.org/psr/psr-17/) request factory as well as the
31+
[Ivory Serializer](https://github.com/egeloen/ivory-serializer) which is an advanced (de)-serialization library.
3232

33-
[Httplug](https://httplug.io/) and [Ivory Serializer](https://github.com/egeloen/ivory-serializer) provide bundles, so
34-
let's install them to ease our life:
33+
The simplest implementation of PSR compatible libraries is using Symfony's [HttpClient](https://github.com/symfony/http-client)
34+
and a lightweight [PSR-7 library](https://github.com/Nyholm/psr7) by [Tobias Nyholm](https://github.com/Nyholm).
35+
Next to that use the [Ivory Serializer](https://github.com/egeloen/ivory-serializer) bundle, so let's install them to ease our life:
3536

3637
``` bash
3738
$ composer require egeloen/serializer-bundle
38-
$ composer require php-http/guzzle7-adapter
39-
$ composer require php-http/httplug-bundle
39+
$ composer require symfony/http-client
40+
$ composer require nyholm/psr7
4041
```
4142

42-
Here, I have chosen to use [Guzzle7](https://docs.guzzlephp.org/en/latest/psr7.html) but since Httplug supports the
43-
most popular http clients, you can install your preferred one instead.
44-
4543
## Register the bundle
4644

4745
Then, add the bundle in your `AppKernel`:
@@ -57,7 +55,14 @@ public function registerBundles()
5755

5856
// Optionally
5957
new Ivory\SerializerBundle\IvorySerializerBundle(),
60-
new Http\HttplugBundle\HttplugBundle(),
6158
];
6259
}
6360
```
61+
62+
When using the [FrameworkBundle](https://github.com/symfony/framework-bundle) you will have a PSR-18 client service available
63+
under `psr18.http_client`. Otherwise you would need to create a service definition for the
64+
`Symfony\Component\HttpClient\Psr18Client` class and use that in the following Google service definitions in this bundle.
65+
66+
The request factory implementation will be available as `nyholm.psr7.psr17_factory` when you use Symfony Flex in your
67+
project. If not you must add a service definition for `Nyholm\Psr7\Factory\Psr17Factory` to be able to complete the
68+
configuration.

Resources/doc/service/direction.md

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ 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 a serializer. The library relies respectively on
11-
[Httplug](http://httplug.io/) which is an http client abstraction library and the
12-
[Ivory Serializer](https://github.com/egeloen/ivory-serializer) which is an advanced (de)-serialization library.
10+
The Direction API requires an [PSR-18](https://www.php-fig.org/psr/psr-18/) http client and a serializer. Any PSR-18
11+
http client library is suitable, [HttpClient](https://github.com/symfony/http-client) is a popular and steady choice nowadays.
12+
And the [Ivory Serializer](https://github.com/egeloen/ivory-serializer) which is an advanced (de)-serialization library.
1313

1414
To install them, read this [documentation](/Resources/doc/installation.md).
1515

@@ -21,26 +21,14 @@ By default, the direction service is disabled. In order to enable the service, y
2121

2222
The http client and message factory are mandatory. They define which http client and message factory the direction
2323
service will use for issuing http requests.
24-
25-
First, configure the [Httplug](http://httplug.io/) bundle.
2624

27-
``` yaml
28-
httplug:
29-
classes:
30-
client: Http\Adapter\Guzzle7\Client
31-
message_factory: Http\Message\MessageFactory\GuzzleMessageFactory
32-
clients:
33-
acme:
34-
factory: httplug.factory.guzzle7
35-
```
36-
37-
Then, configure the Google Map bundle:
25+
Configure the Google Map bundle:
3826

3927
``` yaml
4028
ivory_google_map:
4129
direction:
42-
client: httplug.client.default
43-
message_factory: httplug.message_factory.default
30+
client: psr18.http_client
31+
message_factory: nyholm.psr7.psr17_factory
4432
```
4533
4634
### Format

Resources/doc/service/distance_matrix.md

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

1010
## Dependencies
1111

12-
The Distance Matrix API requires an http client and a serializer. The library relies respectively on
13-
[Httplug](http://httplug.io/) which is an http client abstraction library and the
14-
[Ivory Serializer](https://github.com/egeloen/ivory-serializer) which is an advanced (de)-serialization library.
12+
The Distance Matrix API requires an [PSR-18](https://www.php-fig.org/psr/psr-18/) http client and a serializer. Any PSR-18
13+
http client library is suitable, [HttpClient](https://github.com/symfony/http-client) is a popular and steady choice nowadays.
14+
And the [Ivory Serializer](https://github.com/egeloen/ivory-serializer) which is an advanced (de)-serialization library.
1515

1616
To install them, read this [documentation](/Resources/doc/installation.md).
1717

@@ -24,25 +24,13 @@ By default, the distance matrix service is disabled. In order to enable the serv
2424
The http client and message factory are mandatory. They define which http client and message factory the distance
2525
matrix service will use for issuing http requests.
2626

27-
First, configure the [Httplug](http://httplug.io/) bundle.
28-
29-
``` yaml
30-
httplug:
31-
classes:
32-
client: Http\Adapter\Guzzle7\Client
33-
message_factory: Http\Message\MessageFactory\GuzzleMessageFactory
34-
clients:
35-
acme:
36-
factory: httplug.factory.guzzle7
37-
```
38-
39-
Then, configure the Google Map bundle:
27+
Configure the Google Map bundle:
4028

4129
``` yaml
4230
ivory_google_map:
4331
distance_matrix:
44-
client: httplug.client.default
45-
message_factory: httplug.message_factory.default
32+
client: psr18.http_client
33+
request_factory: nyholm.psr7.psr17_factory
4634
```
4735
4836
### Format

Resources/doc/service/elevation.md

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

77
## Dependencies
88

9-
The Elevation API requires an http client and a serializer. The library relies respectively on
10-
[Httplug](http://httplug.io/) which is an http client abstraction library and the
11-
[Ivory Serializer](https://github.com/egeloen/ivory-serializer) which is an advanced (de)-serialization library.
9+
The Elevation API requires an [PSR-18](https://www.php-fig.org/psr/psr-18/) http client and a serializer. Any PSR-18
10+
http client library is suitable, [HttpClient](https://github.com/symfony/http-client) is a popular and steady choice nowadays.
11+
And the [Ivory Serializer](https://github.com/egeloen/ivory-serializer) which is an advanced (de)-serialization library.
1212

1313
To install them, read this [documentation](/Resources/doc/installation.md).
1414

@@ -21,25 +21,13 @@ By default, the elevation service is disabled. In order to enable the service, y
2121
The http client and message factory are mandatory. They define which http client and message factory the direction
2222
service will use for issuing http requests.
2323

24-
First, configure the [Httplug](http://httplug.io/) bundle.
25-
26-
``` yaml
27-
httplug:
28-
classes:
29-
client: Http\Adapter\Guzzle7\Client
30-
message_factory: Http\Message\MessageFactory\GuzzleMessageFactory
31-
clients:
32-
acme:
33-
factory: httplug.factory.guzzle7
34-
```
35-
36-
Then, configure the Google Map bundle:
24+
Configure the Google Map bundle:
3725

3826
``` yaml
3927
ivory_google_map:
4028
elevation:
41-
client: httplug.client.default
42-
message_factory: httplug.message_factory.default
29+
client: psr18.http_client
30+
request_factory: nyholm.psr7.psr17_factory
4331
```
4432
4533
### Format

Resources/doc/service/geocoder.md

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

88
## Dependencies
99

10-
The Geocoder API requires an http client and a serializer. The library relies respectively on
11-
[Httplug](http://httplug.io/) which is an http client abstraction library and the
12-
[Ivory Serializer](https://github.com/egeloen/ivory-serializer) which is an advanced (de)-serialization library.
10+
The Geocoder API requires an [PSR-18](https://www.php-fig.org/psr/psr-18/) http client and a serializer. Any PSR-18
11+
http client library is suitable, [HttpClient](https://github.com/symfony/http-client) is a popular and steady choice nowadays.
12+
And the [Ivory Serializer](https://github.com/egeloen/ivory-serializer) which is an advanced (de)-serialization library.
1313

1414
To install them, read this [documentation](/Resources/doc/installation.md).
1515

@@ -22,25 +22,13 @@ By default, the geocoder service is disabled. In order to enable the service, yo
2222
The http client and message factory are mandatory. They define which http client and message factory the geocoder
2323
service will use for issuing http requests.
2424

25-
First, configure the [Httplug](http://httplug.io/) bundle.
26-
27-
``` yaml
28-
httplug:
29-
classes:
30-
client: Http\Adapter\Guzzle7\Client
31-
message_factory: Http\Message\MessageFactory\GuzzleMessageFactory
32-
clients:
33-
acme:
34-
factory: httplug.factory.guzzle7
35-
```
36-
37-
Then, configure the Google Map bundle:
25+
Configure the Google Map bundle:
3826

3927
``` yaml
4028
ivory_google_map:
4129
geocoder:
42-
client: httplug.client.default
43-
message_factory: httplug.message_factory.default
30+
client: psr18.http_client
31+
request_factory: nyholm.psr7.psr17_factory
4432
```
4533
4634
### Format

Resources/doc/service/place/autocomplete.md

Lines changed: 7 additions & 19 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 a serializer. The library relies respectively on
16-
[Httplug](http://httplug.io/) which is an http client abstraction library and the
17-
[Ivory Serializer](https://github.com/egeloen/ivory-serializer) which is an advanced (de)-serialization library.
15+
The Place Autocomplete API requires an [PSR-18](https://www.php-fig.org/psr/psr-18/) http client and a serializer. Any PSR-18
16+
http client library is suitable, [HttpClient](https://github.com/symfony/http-client) is a popular and steady choice nowadays.
17+
And the [Ivory Serializer](https://github.com/egeloen/ivory-serializer) which is an advanced (de)-serialization library.
1818

1919
To install them, read this [documentation](/Resources/doc/installation.md).
2020

@@ -25,27 +25,15 @@ By default, the place autocomplete service is disabled. In order to enable the s
2525
### Http client and message factory
2626

2727
The http client and message factory are mandatory. They define which http client and message factory the place
28-
autocomplete service will use for issuing http requests.
29-
30-
First, configure the [Httplug](http://httplug.io/) bundle.
28+
autocomplete service will use for issuing http requests. Here we use `symfony/http-client` and `nyholm/psr7`.
3129

32-
``` yaml
33-
httplug:
34-
classes:
35-
client: Http\Adapter\Guzzle7\Client
36-
message_factory: Http\Message\MessageFactory\GuzzleMessageFactory
37-
clients:
38-
acme:
39-
factory: httplug.factory.guzzle7
40-
```
41-
42-
Then, configure the Google Map bundle:
30+
Configure the Google Map bundle:
4331

4432
``` yaml
4533
ivory_google_map:
4634
place_autocomplete:
47-
client: httplug.client.default
48-
message_factory: httplug.message_factory.default
35+
client: psr18.http_client
36+
message_factory: nyholm.psr7.psr17_factory
4937
```
5038
5139
### Format

0 commit comments

Comments
 (0)