2017 © Pedro Peláez
 

library postcode-api-nu

Postcode API library (postcodeapi.nu)

image

niborb/postcode-api-nu

Postcode API library (postcodeapi.nu)

  • Sunday, March 20, 2016
  • by niborb
  • Repository
  • 1 Watchers
  • 2 Stars
  • 24 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

postcode-api-nu (deprecated, not maintained anymore)

Build Status, (*1)

PHP Library for the free Dutch Postcode API NU service: postcodeapi.nu

Installation

You have to request an API Key from postcodeapi.nu to be able to use the postcode service. (it's free!) - http://www.postcodeapi.nu/#benefits-developers-tab, (*2)

You can install the library with Composer., (*3)

composer.phar require "niborb/postcode-api-nu=dev-master"

The library needs a PSR-0 loader, like the one Composer provides., (*4)

Usage

<?php
require 'vendor/autoload.php';

use Niborb\PostcodeAPI\PostcodeAPI;

$apiKey = '###YOUR-POSTCODE-API-NU-KEY###';
$service = new PostCodeAPI($apiKey);

// postalcode + housenumber
$address = $service->getAddressByPostalcodeAndHouseNumber('5041EB', 21);
echo $address . "\n\n";

// only by postalcode
$address = $service->getAddressByPostalcode('5041EB');
echo $address . "\n\n";

// by geo latitude and longitude
$address = $service->getAddressByLatitudeAndLongitude(51.5664, 5.07718);
echo $address . "\n\n";

Output:, (*5)

Street: Wilhelminapark 21
Postalcode: 5041EB
Town: Tilburg
Municipality: Tilburg
Province: Noord-Brabant
Latitude: 51,5664
Longitude: 5,07718

Street: Wilhelminapark 
Postalcode: 5041EB
Town: Tilburg
Municipality: Tilburg
Province: Noord-Brabant
Latitude: 51,5663166667
Longitude: 5,0771925


Street: Wilhelminapark 21
Postalcode: 5041EB
Town: Tilburg
Municipality: Tilburg
Province: Noord-Brabant
Latitude: 51,5664
Longitude: 5,07718

PHPSpec

The library contains PHPSpec tests (./spec). Clone the repository and run:, (*6)

vendor/bin/phpspec run

The Versions

20/03 2016

dev-master

9999999-dev

Postcode API library (postcodeapi.nu)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Robin Breuker