dev-master
9999999-devPostcode API library (postcodeapi.nu)
MIT
The Requires
- php >=5.3.3
- symfony/console 2.4.*
- guzzle/guzzle ~3.7
The Development Requires
by Robin Breuker
Wallogit.com
2017 © Pedro Peláez
Postcode API library (postcodeapi.nu)
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)
<?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
The library contains PHPSpec tests (./spec). Clone the repository and run:, (*6)
vendor/bin/phpspec run
Postcode API library (postcodeapi.nu)
MIT