Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 20 additions & 41 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,25 @@ jobs:
tests:
runs-on: ubuntu-latest

name: PHP ${{ matrix.php }} - ${{ matrix.symfony-version }} - ${{ matrix.stability }}
name: PHP ${{ matrix.php }} - ${{ matrix.symfony }} - ${{ matrix.deps }}

strategy:
fail-fast: false
matrix:
php: [8.3]
stability: [ prefer-stable ]
symfony-version: [ '7.0.*' ]
php: [8.2, 8.3, 8.4, 8.5]
deps: [ locked ]
symfony: [ '6.4.*', '7.3.*' ]
include:
- php: '8.1'
symfony-version: 6.4.*
stability: prefer-lowest
- php: '8.1'
symfony-version: 6.4.*
stability: prefer-stable
- php: '8.2'
symfony-version: 6.4.*
stability: prefer-stable
- php: '8.2'
symfony-version: 7.0.*
stability: prefer-stable
- php: '8.3'
symfony-version: 7.0.*
stability: prefer-stable
- php: '8.4'
symfony-version: 7.0.*
stability: prefer-stable
- symfony: '6.4.*'
php: '8.1'
deps: lowest
- symfony: '7.4.*'
php: '8.5'
deps: highest

env:
APP_ENV: test
SYMFONY_REQUIRE: ${{ matrix.symfony }}

steps:
-
Expand All @@ -51,32 +40,22 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php }}"
ini-values: zend.exception_ignore_args=false
extensions: intl
tools: symfony
tools: symfony, flex
coverage: none

-
name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
name: Configure composer
if: "${{ matrix.deps == 'highest' }}"
run: composer config minimum-stability dev

-
name: Cache Composer
uses: actions/cache@v4
name: Composer install
uses: ramsey/composer-install@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.php }}-composer-

-
name: Install PHP dependencies
env:
SYMFONY_REQUIRE: ${{ matrix.symfony-version }}
run: |
composer global config --no-plugins allow-plugins.symfony/flex true
composer global require --no-progress --no-scripts --no-plugins symfony/flex
composer update --no-interaction --prefer-dist
dependency-versions: '${{ matrix.deps }}'
composer-options: --no-interaction --prefer-dist

-
name: Run analysis
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# CHANGELOG

### 7.0.0 (xxx)

* [PSR-17](https://www.php-fig.org/psr/psr-17/) and [PSR-18](https://www.php-fig.org/psr/psr-18/) implementation
* Drop support for Symfony 7.0, 7.1, 7.2

### 3.0.1 (2020-06-12)

* fixed issue #1 Nullable return type declaration fails with php 7.0
Expand Down
27 changes: 17 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,32 @@
],
"require": {
"php": "^8.1",
"symfony/event-dispatcher": "^6.4 || ^7.0",
"symfony/serializer": "^6.4 || ^7.0",
"symfony/property-access": "^6.4 || ^7.0",
"symfony/event-dispatcher": "^6.4 || ^7.3",
"symfony/serializer": "^6.4 || ^7.3",
"symfony/property-access": "^6.4 || ^7.3",
"phpdocumentor/reflection-docblock": "^5.3",
"php-http/message-factory": "^1.1"
"psr/http-factory": "^1.1",
"psr/http-client": "^1.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.49",
"php-http/cache-plugin": "^2.0",
"php-http/guzzle7-adapter": "^1.0",
"phpunit/phpunit": "^9.6.16",
"phpunit/phpunit-selenium": "^9.0",
"symfony/cache": "^6.4 || ^7.0",
"symfony/phpunit-bridge": "^6.4 || ^7.0",
"ext-json": "*"
"symfony/cache": "^6.4 || ^7.3",
"symfony/http-client": "^6.4 || ^7.3",
"symfony/phpunit-bridge": "^6.4 || ^7.3",
"ext-json": "*",
"nyholm/psr7": "^1.8"
},
"scripts": {
"test": "vendor/bin/phpunit -c phpunit.ci.xml"
},
"suggest": {
"php-http/client-implementation": "Allows to use http services",
"php-http/message": "Allows to use http services"
"symfony/http-client": "For a fast PSR-18 client",
"php-http/guzzle7-adapter": "For a widely used PSR-18 client",
"nyholm/psr7": "Lightweight PSR-7/17 implementation",
"php-http/discovery": "To auto-discover installed HTTP clients/factories"
},
"replace": {
"egeloen/google-map": "^2.0.2"
Expand Down
13 changes: 6 additions & 7 deletions doc/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,17 @@ composer require ivory/google-map

## Download additional libraries

### Httplug
### PSR-17 and PSR-18

If you want to use a service (geocoder, direction, ...), you will need an http client and message factory via
[Httplug](http://httplug.io/) which is an http client abstraction library:
If you want to use a service (geocoder, direction, ...), you will need an http client and request factory, this bundle is
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.
This means that any http client or request factory library which supports these specifications can be used within this bundle.

``` bash
composer require php-http/guzzle7-adapter
composer require php-http/message
composer require symfony/http-client
```

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

### Ivory Serializer

Expand Down
26 changes: 13 additions & 13 deletions doc/service/direction/direction.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,38 @@ or as latitude/longitude coordinates. The Direction API can return multi-part di

## Dependencies

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

## Build

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

``` php
use Ivory\GoogleMap\Service\Direction\DirectionService;
use Http\Adapter\Guzzle7\Client;
use Http\Message\MessageFactory\GuzzleMessageFactory;
use Symfony\Component\HttpClient\Psr18Client;
use Nyholm\Psr7\Factory\Psr17Factory;

$direction = new DirectionService(new Client(), new GuzzleMessageFactory());
$direction = new DirectionService(new Psr18Client(), new Psr17Factory());
```

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

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

``` php
use Ivory\GoogleMap\Service\Direction\DirectionService;
use Ivory\GoogleMap\Service\Serializer\SerializerBuilder;
use Http\Adapter\Guzzle7\Client;
use Http\Message\MessageFactory\GuzzleMessageFactory;
use Symfony\Component\HttpClient\Psr18Client;
use Nyholm\Psr7\Factory\Psr17Factory;

$direction = new DirectionService(
new Client(),
new GuzzleMessageFactory(),
new Psr18Client(),
new Psr17Factory(),
SerializerBuilder::create($psr6Pool)
);
```
Expand Down
26 changes: 13 additions & 13 deletions doc/service/distance_matrix/distance_matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,38 @@ single origin and destination to the [Direction API](/doc/service/direction/dire

## Dependencies

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

## Build

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

``` php
use Ivory\GoogleMap\Service\DistanceMatrix\DistanceMatrixService;
use Http\Adapter\Guzzle7\Client;
use Http\Message\MessageFactory\GuzzleMessageFactory;
use Symfony\Component\HttpClient\Psr18Client;
use Nyholm\Psr7\Factory\Psr17Factory;

$distanceMatrix = new DistanceMatrixService(new Client(), new GuzzleMessageFactory());
$distanceMatrix = new DistanceMatrixService(new Psr18Client(), new Psr17Factory());
```

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

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

``` php
use Ivory\GoogleMap\Service\DistanceMatrix\DistanceMatrixService;
use Ivory\GoogleMap\Service\Serializer\SerializerBuilder;
use Http\Adapter\Guzzle7\Client;
use Http\Message\MessageFactory\GuzzleMessageFactory;
use Symfony\Component\HttpClient\Psr18Client;
use Nyholm\Psr7\Factory\Psr17Factory;

$distanceMatrix = new DistanceMatrixService(
new Client(),
new GuzzleMessageFactory(),
new Psr18Client(),
new Psr17Factory(),
SerializerBuilder::create($psr6Pool)
);
```
Expand Down
26 changes: 13 additions & 13 deletions doc/service/elevation/elevation.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,38 @@ routes.

## Dependencies

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

## Build

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

``` php
use Ivory\GoogleMap\Service\Elevation\ElevationService;
use Http\Adapter\Guzzle7\Client;
use Http\Message\MessageFactory\GuzzleMessageFactory;
use Symfony\Component\HttpClient\Psr18Client;
use Nyholm\Psr7\Factory\Psr17Factory;

$elevation = new ElevationService(new Client(), new GuzzleMessageFactory());
$elevation = new ElevationService(new Psr18Client(), new Psr17Factory());
```

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

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

``` php
use Ivory\GoogleMap\Service\Elevation\ElevationService;
use Ivory\GoogleMap\Service\Serializer\SerializerBuilder;
use Http\Adapter\Guzzle7\Client;
use Http\Message\MessageFactory\GuzzleMessageFactory;
use Symfony\Component\HttpClient\Psr18Client;
use Nyholm\Psr7\Factory\Psr17Factory;

$elevation = new ElevationService(
new Client(),
new GuzzleMessageFactory(),
new Psr18Client(),
new Psr17Factory(),
SerializerBuilder::create($psr6Pool)
);
```
Expand Down
26 changes: 13 additions & 13 deletions doc/service/geocoder/geocoder.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,38 @@ process is known as "reverse geocoding".

## Dependencies

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

## Build

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

``` php
use Ivory\GoogleMap\Service\Geocoder\GeocoderService;
use Http\Adapter\Guzzle7\Client;
use Http\Message\MessageFactory\GuzzleMessageFactory;
use Symfony\Component\HttpClient\Psr18Client;
use Nyholm\Psr7\Factory\Psr17Factory;

$geocoder = new GeocoderService(new Client(), new GuzzleMessageFactory());
$geocoder = new GeocoderService(new Psr18Client(), new Psr17Factory());
```

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

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

``` php
use Ivory\GoogleMap\Service\Geocoder\GeocoderService;
use Ivory\GoogleMap\Service\Serializer\SerializerBuilder;
use Http\Adapter\Guzzle7\Client;
use Http\Message\MessageFactory\GuzzleMessageFactory;
use Symfony\Component\HttpClient\Psr18Client;
use Nyholm\Psr7\Factory\Psr17Factory;

$geocoder = new GeocoderService(
new Client(),
new GuzzleMessageFactory(),
new Psr18Client(),
new Psr17Factory(),
SerializerBuilder::create($psr6Pool)
);
```
Expand Down
Loading