ici-brussels / bpost-addresses
A php class for Bpost addresses validation API
0.1.7
2017-11-05 08:43 UTC
Requires
- guzzlehttp/guzzle: ^6.3
This package is not auto-updated.
Last update: 2025-02-12 09:58:09 UTC
README
A php class for Bpost addresses validation API
bpost (Belgian Post Group) provides an API to validate belgian address : https://www.bpost.be/site/en/webservice-address.
The goal of this tool is to help querying the bpost API easily with PHP.
Install
The tool only requires PHP 7.0+ and guzzlehttp/guzzle.
Use it via composer + packagist: https://packagist.org/packages/ici-brussels/bpost-addresses
Usage
$bpost = new Bpost_Address_Validation(); // Find relevant address according to input /* Option 1: Structured */ $bpost->getAddress_Structured("Rue de la loix", "15", null, 1000, "Bruxelles"); /* Option 2: Unstructured */ $bpost->getAddress_Unstructured("rue de la loi 15, 1000 bruxelles"); // get array with validated address $result = $bpost->getStructuredAddress(); print_r($result); /* Array ( [StreetName] => Rue De La Loi [StreetNumber] => 15 [BoxNumber] => [PostalCode] => 1040 [MunicipalityName] => Bruxelles [CountryName] => Belgique ) */ // get array with latitude/longitude $result = $bpost->getGeographicalLocation(); print_r($result); /* Array ( [lat] => 50.845465 [lon] => 4.369107 ) */
Credits
- Created by Bruno Veyckemans (ici Bruxelles). All comments and suggestions welcome !
- Inspired by (geo6/bpost-batch-validation)
- Thanks to Xavier Querriau @ bpost for the API