elifuzz/postcode-nl

PHP 对 Postcode.nl 荷兰地址验证 API 的包装器

安装: 6

依赖: 0

建议者: 0

安全: 0

星标: 0

关注者: 1

分支: 0

开放问题: 2

类型:项目

1.0.0 2020-01-21 16:06 UTC

This package is auto-updated.

Last update: 2024-09-19 22:36:27 UTC


README

GitHub GitHub

Postcode.nl PHP API REST 客户端

一个 PHP 包装器,提供与Postcode.nl API直接通信的方法。

安装

  1. 创建账户: Postcode.nl API
  2. 将库添加到项目中
  3. 使用您的认证详情实例化 PHP 类
  4. 调用 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());
}

文档