elifuzz / postcode-nl
PHP 对 Postcode.nl 荷兰地址验证 API 的包装器
1.0.0
2020-01-21 16:06 UTC
Requires
- php: ^7.2.5
- ext-json: *
- guzzlehttp/guzzle: 6.5.2
Requires (Dev)
- friendsofphp/php-cs-fixer: 2.16.1
- phpunit/phpunit: 8.5.2
This package is auto-updated.
Last update: 2024-09-19 22:36:27 UTC
README
Postcode.nl PHP API REST 客户端
一个 PHP 包装器,提供与Postcode.nl API直接通信的方法。
安装
- 创建账户: Postcode.nl API
- 将库添加到项目中
- 使用您的认证详情实例化 PHP 类
- 调用
lookupAddress
方法
用法
try { $client = new RestApi\RestClient('{your key}', '{your secret}'); $address = $client->lookupAddress('{postcode}', '{houseNumber}', '{houseNumberAddition}'); var_dump($address); } catch (RestApi\Exception\AddressNotFoundException $e) { die($e->getMessage()); } catch (RestApi\Exception\InputInvalidException $e) { die($e->getMessage()); } catch (RestApi\Exception\AuthenticationException $e) { die($e->getMessage()); } catch (RestApi\Exception\ServiceException $e) { die($e->getMessage()); }