2017 © Pedro Peláez
 

library postcode-api-client

Client library for the postcodeapi.nu web service.

image

freshheads/postcode-api-client

Client library for the postcodeapi.nu web service.

  • Thursday, March 22, 2018
  • by freshheads
  • Repository
  • 6 Watchers
  • 13 Stars
  • 20,694 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 5 Forks
  • 0 Open issues
  • 8 Versions
  • 9 % Grown

The README.md

FHPostcodeAPIClient

Build Status, (*1)

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., (*2)

Links:, (*3)

Installation

FHPostcodeAPIClient can easily be installed using Composer:, (*4)

composer require freshheads/postcode-api-client

Usage

Instantiate the client and replace the API key with your personal credentials:, (*5)

// Use the composer autoloader to load dependencies
require_once 'vendor/autoload.php';

// initiate client
$apiKey = 'replace_with_your_own_api_key';
// In this example we made use of the Guzzle as HTTPClient.
$client = new \FH\PostcodeAPI\Client(
    new GuzzleHttp\Client([
        'headers' => [
            'X-Api-Key' => $apiKey
        ]
    ])
);

// call endpoints
$response = $client->getAddresses('5041EB', 21);
$response = $client->getAddress('0855200000061001');
$response = $client->getPostcodeDataByPostcode('5041EB');

// Note that this call is only available with a premium account
$response = $client->getPostcodes('51.566405', '5.077171');

Within a Symfony project

We recommend to use Guzzle, to be able to use Guzzle in combination with the PostcodeApiClient. Following definition is used with an implementation of Guzzle 7., (*6)

_defaults:
        autowire: true
        autoconfigure: true

    project.http.client.postal_code:
        class: GuzzleHttp\Client
        bind:
            $config: { headers: { X-Api-Key: '%postcode_api_nu.key%' } }

    FH\PostcodeAPI\Client:
        $httpClient: '@project.http.client.postal_code'

You should now be able use the FH\PostcodeAPI\Client service to make requests to the PostcodeAPI., (*7)

Guzzle 6

To make use of Guzzle 6, you should also make use of the Guzzle6Adapter. By running the following command you automatically install Guzzle as well., (*8)

composer require php-http/guzzle6-adapter

And add the following service definitions (usable in Symfony ^3.4):, (*9)

services:
    _defaults:
        autowire: true
        autoconfigure: true

    project.http.guzzle.client:
        class: GuzzleHttp\Client
        arguments:
            - { headers: { X-Api-Key: 'replace_with_your_own_api_key_or_variable' } }

    project.http.adapter.guzzle.client:
        class: Http\Adapter\Guzzle6\Client
        arguments:
            $client: '@project.http.guzzle.client'

    FH\PostcodeAPI\Client:
        $httpClient: '@project.http.adapter.guzzle.client'

The Versions

22/03 2018

dev-master

9999999-dev http://www.postcodeapi.nu

Client library for the postcodeapi.nu web service.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Joost Farla
by Gijs Nieuwenhuis

api client postcode

22/03 2018

3.1.0

3.1.0.0 http://www.postcodeapi.nu

Client library for the postcodeapi.nu web service.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Joost Farla
by Gijs Nieuwenhuis

api client postcode

05/01 2017

3.0.0

3.0.0.0 http://www.postcodeapi.nu

Client library for the postcodeapi.nu web service.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Joost Farla
by Gijs Nieuwenhuis

api client postcode

16/02 2016

2.0.1

2.0.1.0 http://www.postcodeapi.nu

Client library for the postcodeapi.nu web service.

  Sources   Download

MIT

The Requires

 

by Joost Farla
by Gijs Nieuwenhuis

api client postcode

18/01 2016

2.0.0

2.0.0.0 http://www.postcodeapi.nu

Client library for the postcodeapi.nu web service.

  Sources   Download

MIT

The Requires

 

by Joost Farla
by Gijs Nieuwenhuis

api client postcode

11/06 2015

1.0.2

1.0.2.0 http://www.postcodeapi.nu

Client library for the postcodeapi.nu web service.

  Sources   Download

MIT

The Requires

 

by Joost Farla

api client postcode

06/08 2013

1.0.1

1.0.1.0 http://www.postcodeapi.nu

Client library for the postcodeapi.nu web service.

  Sources   Download

MIT

The Requires

 

by Joost Farla

api client postcode

06/02 2013

v1.0.0

1.0.0.0 http://www.postcodeapi.nu

Client library for the postcodeapi.nu web service.

  Sources   Download

MIT

The Requires

 

by Joost Farla

api client postcode