PHP code example of geo6 / geocoder-php-bpost-provider
1. Go to this page and download the library: Download geo6/geocoder-php-bpost-provider library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
geo6 / geocoder-php-bpost-provider example snippets
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);