PHPackages                             freshheads/postcode-api-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. freshheads/postcode-api-client

ActiveLibrary[API Development](/categories/api)

freshheads/postcode-api-client
==============================

Client library for the postcodeapi.nu web service.

4.1.1(4y ago)16125.5k↓29.6%8[1 PRs](https://github.com/freshheads/FHPostcodeAPIClient/pulls)MITPHPPHP &gt;=7.4

Since Feb 6Pushed 4y ago10 watchersCompare

[ Source](https://github.com/freshheads/FHPostcodeAPIClient)[ Packagist](https://packagist.org/packages/freshheads/postcode-api-client)[ Docs](https://www.postcodeapi.nu)[ RSS](/packages/freshheads-postcode-api-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (4)Versions (12)Used By (0)

FHPostcodeAPIClient
===================

[](#fhpostcodeapiclient)

[![Build Status](https://camo.githubusercontent.com/fc6d07f67383b1e4dbd973a10eddd8cf9b8e22f3947f8dbe223c21a638b7cb5a/68747470733a2f2f7472617669732d63692e6f72672f667265736868656164732f4648506f7374636f6465415049436c69656e742e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/freshheads/FHPostcodeAPIClient)

FHPostcodeAPIClient is a PHP client library for the PostcodeAPI.nu web service. This library is developed by [Freshheads](https://www.freshheads.com) and will be maintained in sync with the web service itself.

**Links:**

- [More information](https://www.postcodeapi.nu)
- [API documentation](https://swaggerhub.com/api/apiwise/postcode-api)

Installation
------------

[](#installation)

FHPostcodeAPIClient can easily be installed using [Composer](https://getcomposer.org/):

```
composer require freshheads/postcode-api-client
```

Usage
-----

[](#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';
// 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
------------------------

[](#within-a-symfony-project)

We recommend to use [Guzzle](https://github.com/guzzle/guzzle), to be able to use Guzzle in combination with the PostcodeApiClient. Following definition is used with an implementation of `Guzzle 7`.

```
_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.

#### Guzzle 6

[](#guzzle-6)

To make use of `Guzzle 6`, you should also make use of the [Guzzle6Adapter](https://github.com/php-http/guzzle6-adapter). By running the following command you automatically install Guzzle as well.

```
composer require php-http/guzzle6-adapter
```

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

```
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'
```

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity41

Moderate usage in the ecosystem

Community21

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~335 days

Recently: every ~371 days

Total

11

Last Release

1494d ago

Major Versions

1.0.2 → 2.0.02016-01-18

2.0.1 → 3.0.02017-01-05

3.1.0 → 4.0.02019-08-16

PHP version history (5 changes)v1.0.0PHP &gt;=5.3.2

2.0.0PHP &gt;=5.4.0

4.0.0PHP ^7.1

4.1.0PHP ^7.2

4.1.1PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/ff992fa795ece06cce9b7703889c79e728c345d5abbfedd53b89b023ca3f0b95?d=identicon)[freshheads](/maintainers/freshheads)

![](https://www.gravatar.com/avatar/c1fb962fbcdb8ca6eb8f978e1dca5798aeab182097a79f7896a1fdc7f963aab0?d=identicon)[evertharmeling](/maintainers/evertharmeling)

---

Top Contributors

[![evertharmeling](https://avatars.githubusercontent.com/u/308513?v=4)](https://github.com/evertharmeling "evertharmeling (8 commits)")[![bart-van-amelsvoort](https://avatars.githubusercontent.com/u/3480110?v=4)](https://github.com/bart-van-amelsvoort "bart-van-amelsvoort (4 commits)")[![fastnloud](https://avatars.githubusercontent.com/u/4117844?v=4)](https://github.com/fastnloud "fastnloud (2 commits)")[![bitdeli-chef](https://avatars.githubusercontent.com/u/3092978?v=4)](https://github.com/bitdeli-chef "bitdeli-chef (1 commits)")[![bryantebeek](https://avatars.githubusercontent.com/u/2136273?v=4)](https://github.com/bryantebeek "bryantebeek (1 commits)")[![gnoesiboe](https://avatars.githubusercontent.com/u/1663751?v=4)](https://github.com/gnoesiboe "gnoesiboe (1 commits)")[![slokhorst](https://avatars.githubusercontent.com/u/8083666?v=4)](https://github.com/slokhorst "slokhorst (1 commits)")

---

Tags

apiclientpostcode

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/freshheads-postcode-api-client/health.svg)

```
[![Health](https://phpackages.com/badges/freshheads-postcode-api-client/health.svg)](https://phpackages.com/packages/freshheads-postcode-api-client)
```

###  Alternatives

[openai-php/client

OpenAI PHP is a supercharged PHP API client that allows you to interact with the Open AI API

5.8k22.6M232](/packages/openai-php-client)[algolia/algoliasearch-client-php

API powering the features of Algolia.

69333.0M114](/packages/algolia-algoliasearch-client-php)[theodo-group/llphant

LLPhant is a library to help you build Generative AI applications.

1.5k311.5k5](/packages/theodo-group-llphant)[deepseek-php/deepseek-php-client

deepseek PHP client is a robust and community-driven PHP client library for seamless integration with the Deepseek API, offering efficient access to advanced AI and data processing capabilities.

47073.9k5](/packages/deepseek-php-deepseek-php-client)[mozex/anthropic-php

Anthropic PHP is a supercharged community-maintained PHP API client that allows you to interact with Anthropic API.

46365.1k13](/packages/mozex-anthropic-php)[gladyshev/yandex-direct-client

Useful Yandex.Direct API v5 client.

1912.0k](/packages/gladyshev-yandex-direct-client)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
