Client library for the postcodeapi.nu web service.
FHPostcodeAPIClient is a PHP client library for the PostcodeAPI.nu web service. This library is developed by Freshheads and will be maintained in sync with the web service itself.
FHPostcodeAPIClient works with PHP 5.4.0 or up. This library is dependent on the awesome Guzzle HTTP client library. Guzzle 5 version is used instead of the new Guzzle 6, as Guzzle 6 requires the php version to be higher than 5.5.0.
FHPostcodeAPIClient can easily be installed using Composer:
composer require freshheads/postcode-api-client
Instantiate the client and replace the API key with your personal credentials:
// Use the composer autoloader to load dependencies require_once 'vendor/autoload.php'; // initiate client $apiKey = 'replace_with_your_own_api_key'; $client = new \FH\PostcodeAPI\Client(new \GuzzleHttp\Client(), $apiKey); // call endpoints $response = $client->getAddresses('5041EB', 21); $response = $client->getAddress('0855200000061001');
Version 1 of PostcodeAPI will be available until 29-02-2016. You can still connect to this API via version 1.x of this client library. Version 1.x can be installed via composer:
composer require freshheads/postcode-api-client:^1.0