Skip to content

geo6/geocoder-php-bpost-provider

1.x
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
July 31, 2022 11:05
January 3, 2018 15:46
January 3, 2018 15:46
December 22, 2020 16:31
July 31, 2022 11:05
July 31, 2022 11:06

πŸ‡§πŸ‡ͺ Geocoder PHP "bpost" provider

PHP CI Latest Stable Version Total Downloads Monthly Downloads Code Coverage Scrutinizer Code Quality Software License

Geocoder PHP is a PHP library which helps you build geo-aware applications by providing a powerful abstraction layer for geocoding manipulations.

This is the "bpost" provider for the Geocoder PHP.

Coverage: Belgium
API: https://www.bpost.be/site/en/webservice-address

Install

composer require geo6/geocoder-php-bpost-provider

Usage

See Geocoder PHP README file.

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);