Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jbelien committed Oct 26, 2018
1 parent 1d0f852 commit 9741ac6
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,22 @@ This is the "bpost" provider for the [Geocoder PHP](https://github.com/geocoder-
## Usage

See [Geocoder PHP README file](https://github.com/geocoder-php/Geocoder/blob/master/README.md).

```php
use Geocoder\Query\GeocodeQuery;

$httpClient = new \Http\Adapter\Guzzle6\Client();
$provider = new \Geocoder\Provider\bpost\bpost($httpClient);
$geocoder = new \Geocoder\StatefulGeocoder($provider, 'en');

// Query with unstructured address
$result = $geocoder->geocodeQuery(GeocodeQuery::create('5 Place des Palais 1000 Bruxelles'));

// Query with structured address
$query = GeocodeQuery::create('5 Place des Palais 1000 Bruxelles')
->withData('streetNumber', '5')
->withData('streetName', 'Place des Palais')
->withData('postalCode', '1000')
->withData('locality', 'Bruxelles');
$results = $geocoder->geocodeQuery($query);
```

0 comments on commit 9741ac6

Please sign in to comment.