PHPackages                             hurnell/postcode-api-bundle - 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. hurnell/postcode-api-bundle

ActiveSymfony-bundle

hurnell/postcode-api-bundle
===========================

Symfony 4 bundle for postcodeapi.nu

v1.0.2(6y ago)08MITPHPPHP ^7.1.3

Since May 13Pushed 6y ago1 watchersCompare

[ Source](https://github.com/hurnell/postcode-api-bundle)[ Packagist](https://packagist.org/packages/hurnell/postcode-api-bundle)[ RSS](/packages/hurnell-postcode-api-bundle/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (2)Dependencies (9)Versions (4)Used By (0)

[![Build Status](https://camo.githubusercontent.com/800d5d24256adfe3ae15580f4947730d65ae7e6b9a1bfd43743020550afa475c/68747470733a2f2f7472617669732d63692e6f72672f6875726e656c6c2f706f7374636f64652d6170692d62756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/hurnell/postcode-api-bundle) [![Coverage Status](https://camo.githubusercontent.com/e692dd2c887aa472977eaace99e29e9f8b8c8c737774086f7e8d78b27871d10e/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6875726e656c6c2f706f7374636f64652d6170692d62756e646c652f62616467652e737667)](https://coveralls.io/github/hurnell/postcode-api-bundle) [![License](https://camo.githubusercontent.com/0e7f9ecda02b85d28b786d371c059027d7ffca7915eef81eb606fe29a3458e5a/68747470733a2f2f706f7365722e707567782e6f72672f6875726e656c6c2f706f7374636f64652d6170692d62756e646c652f6c6963656e7365)](https://packagist.org/packages/hurnell/postcode-api-bundle) [![Latest Stable Version](https://camo.githubusercontent.com/8546c11a9fcd5519b06b67b5f20c35fe66bf6416eec6c142acf89ab2f936b64b/68747470733a2f2f706f7365722e707567782e6f72672f6875726e656c6c2f706f7374636f64652d6170692d62756e646c652f762f737461626c65)](https://packagist.org/packages/hurnell/postcode-api-bundle)

postcode-api-bundle
===================

[](#postcode-api-bundle)

A Symfony 4 bundle to access Dutch postcode API at [Postcode API (postcodeapi.nu)](https://www.postcodeapi.nu/). Creates a PostcodeModel object based on postcode, house number &amp; number extra combination.

Characteristics/Requirements
----------------------------

[](#characteristicsrequirements)

Search based on postcode, house number AND house number extra. Note that some combinations of postcode and house number require a house number extra and without this extra value the address does NOT EXIST:

- ('2011XA', 20, '') is not a valid combination. For this combination of postcode and house number, extra must be 'A', 'RD' or 'ZW'.
- For the values ('2011XA', 20, '') the bundle will return an InvalidNumberExtraException with the following message: "House number extra must be (A, RD, ZW) for this combination of postcode and house number."

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

[](#installation)

1. Download via composer.
2. Enable bundle by adding class reference to config/bundles.php (if composer did not do that for you).
3. Create yaml configuration config/packages/hurnell\_postcode\_api.yaml with reference to your api\_key.

### 1 - Download via composer

[](#1---download-via-composer)

```
composer require hurnell/postcode-api-bundle:*
```

### 2 - Enable bundle

[](#2---enable-bundle)

```
# config/bundles.php

Hurnell\PostcodeApiBundle\HurnellPostcodeApiBundle::class => ['all' => true],
```

### 3 - Configure with API key

[](#3---configure-with-api-key)

```
# config/packages/hurnell_postcode_api.yaml

hurnell_postcode_api:
    api_key: 'your_api_key'
```

Usage
-----

[](#usage)

Autowiring is enabled by default so in a controller action (or constructor of other classes)

```
