freshheads/postcode-api-client

Client library for the postcodeapi.nu web service.

Installs: 4 245

Dependents: 0

Stars: 8

Watchers: 4

Forks: 4

Open Issues: 0

2.0.1 2016-02-16 07:56 UTC

README

Build Status

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.

Links:

Requirements

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.

Installation

FHPostcodeAPIClient can easily be installed using Composer:

composer require freshheads/postcode-api-client

Usage

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');

Postcodeapi.nu Version 1

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

Bitdeli Badge