Skip to content

Commit 6dcbe4c

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

62 files changed

Lines changed: 195 additions & 261 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.

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: 15 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 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.
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,13 @@ 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]() you will have the Client service available under `http_client`. Otherwise you would
63+
need to create a service definition for the `Symfony\Component\HttpClient\Psr18Client` class and use that in the following
64+
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 definitionfor `Nyholm\Psr7\Factory\Psr17Factory` to be able to complete the 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 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.
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: http_client
31+
request_factory: nyholm.psr7.psr17_factory
4432
```
4533
4634
### Format

Resources/doc/service/distance_matrix.md

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ 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
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
1414
[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).
@@ -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: http_client
33+
request_factory: nyholm.psr7.psr17_factory
4634
```
4735
4836
### Format

Resources/doc/service/elevation.md

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ 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
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
1111
[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).
@@ -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: http_client
30+
request_factory: nyholm.psr7.psr17_factory
4331
```
4432
4533
### Format

Resources/doc/service/geocoder.md

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ 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
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
1212
[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).
@@ -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: http_client
31+
request_factory: nyholm.psr7.psr17_factory
4432
```
4533
4634
### Format

Resources/doc/service/place/autocomplete.md

Lines changed: 7 additions & 7 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 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.
1818

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

@@ -26,17 +26,17 @@ By default, the place autocomplete service is disabled. In order to enable the s
2626

2727
The http client and message factory are mandatory. They define which http client and message factory the place
2828
autocomplete service will use for issuing http requests.
29-
29+
3030
First, configure the [Httplug](http://httplug.io/) bundle.
3131

3232
``` yaml
3333
httplug:
3434
classes:
35-
client: Http\Adapter\Guzzle7\Client
36-
message_factory: Http\Message\MessageFactory\GuzzleMessageFactory
35+
client: Symfony\Component\HttpClient\Psr18Client
36+
message_factory: Nyholm\Psr7\Factory\Psr17Factory
3737
clients:
3838
acme:
39-
factory: httplug.factory.guzzle7
39+
factory: Symfony\Component\HttpClient\Psr18Client
4040
```
4141
4242
Then, configure the Google Map bundle:

Resources/doc/service/place/detail.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ its complete address, phone number, user rating and reviews.
77

88
## Dependencies
99

10-
The Place Detail 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 Place Detail 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.
1313

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

@@ -21,17 +21,17 @@ By default, the place detail service is disabled. In order to enable the service
2121

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

2727
``` yaml
2828
httplug:
2929
classes:
30-
client: Http\Adapter\Guzzle7\Client
31-
message_factory: Http\Message\MessageFactory\GuzzleMessageFactory
30+
client: Symfony\Component\HttpClient\Psr18Client
31+
message_factory: Nyholm\Psr7\Factory\Psr17Factory
3232
clients:
3333
acme:
34-
factory: httplug.factory.guzzle7
34+
factory: Symfony\Component\HttpClient\Psr18Client
3535
```
3636
3737
Then, configure the Google Map bundle:

Resources/doc/service/place/search.md

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ proximity or a text string. A Place Search returns a list of places along with s
66

77
## Dependencies
88

9-
The Place Autocomplete 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 Place Search 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.
1212

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

@@ -21,25 +21,13 @@ By default, the place search service is disabled. In order to enable the service
2121
The http client and message factory are mandatory. They define which http client and message factory the place
2222
search 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
place_search:
41-
client: httplug.client.default
42-
message_factory: httplug.message_factory.default
29+
client: http_client
30+
request_factory: nyholm.psr7.psr17_factory
4331
```
4432
4533
### Format

0 commit comments

Comments
 (0)