This bundle can be useed to fetch Address details from zipcode with number.
See: https://api-postcode.nl for more information.
Installation is a quick 3 step process:
- Download api-postcode-bundle using composer
- Enable the Bundle in AppKernel.php
- Configure Api Postcode credentials
Add ApiPostcodeBundle by running the command:
$ composer require api-postcode/api-postcode-bundle
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new ApiPostcode\PostcodeBundle\ApiPostcodeBundle(),
);
}
# app/config/config.yml
# Api Postcode Token
api_postcode:
token: secret-token
$address = $this->get('api.postcode')->fetchAddress('1012JS', 1);
$address->getStreet(); // Dam
$address->getCity(); // Amsterdam
$address->getHouseNumber(); // 1
$address->getZipCode(); // 1012JS
$address->getLongitude(); // 4.4584
$address->getLatitude(); // 52.2296
Or try the API response: