@@ -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
1818First 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
2121use 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
3232The distance matrix constructor also accepts a ` SerializerInterface ` as third argument. It is highly recommended to
3333use it in order to configure a PSR-6 cache pool and so avoid parsing the built-in metadata every time.
3434
3535``` php
3636use Ivory\GoogleMap\Service\DistanceMatrix\DistanceMatrixService;
3737use 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```
0 commit comments