Skip to content

Commit 9741ac6

Browse files
author
Jonathan Beliën
committed
Update README.md
1 parent 1d0f852 commit 9741ac6

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,22 @@ This is the "bpost" provider for the [Geocoder PHP](https://github.com/geocoder-
2020
## Usage
2121

2222
See [Geocoder PHP README file](https://github.com/geocoder-php/Geocoder/blob/master/README.md).
23+
24+
```php
25+
use Geocoder\Query\GeocodeQuery;
26+
27+
$httpClient = new \Http\Adapter\Guzzle6\Client();
28+
$provider = new \Geocoder\Provider\bpost\bpost($httpClient);
29+
$geocoder = new \Geocoder\StatefulGeocoder($provider, 'en');
30+
31+
// Query with unstructured address
32+
$result = $geocoder->geocodeQuery(GeocodeQuery::create('5 Place des Palais 1000 Bruxelles'));
33+
34+
// Query with structured address
35+
$query = GeocodeQuery::create('5 Place des Palais 1000 Bruxelles')
36+
->withData('streetNumber', '5')
37+
->withData('streetName', 'Place des Palais')
38+
->withData('postalCode', '1000')
39+
->withData('locality', 'Bruxelles');
40+
$results = $geocoder->geocodeQuery($query);
41+
```

0 commit comments

Comments
 (0)