elifuzz/postcode-nl

PHP wrapper for the Postcode.nl Dutch address verification API

1.0.0 2020-01-21 16:06 UTC

This package is auto-updated.

Last update: 2024-11-19 23:10:35 UTC


README

GitHub GitHub

Postcode.nl PHP API REST Client

A PHP wrapper, which offers methods to directly talk with the Postcode.nl API.

Installation

  1. Create an account: Postcode.nl API
  2. Add library to your project
  3. Instantiate the PHP class with your authentication details
  4. Call the lookupAddress method

Usage

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

Documentation