ici-brussels / bpost-addresses
Bpost地址验证API的PHP类
0.1.7
2017-11-05 08:43 UTC
Requires
- guzzlehttp/guzzle: ^6.3
This package is not auto-updated.
Last update: 2024-09-25 08:21:58 UTC
README
Bpost地址验证API的PHP类
bpost (比利时邮政集团) 提供了一个API来验证比利时地址:https://www.bpost.be/site/en/webservice-address。
此工具的目的是帮助用PHP轻松查询bpost API。
安装
此工具仅需要PHP 7.0+和guzzlehttp/guzzle。
通过composer + packagist使用: https://packagist.org.cn/packages/ici-brussels/bpost-addresses
用法
$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 ) */
鸣谢
- 由Bruno Veyckemans (ici Bruxelles) 创建。欢迎所有评论和建议!
- 灵感来自 (geo6/bpost-batch-validation)
- 感谢Xavier Querriau @ bpost提供的API