keesschepers / postcodenl-api-bundle
http://api.postcode.nl integration in Symfony2.
Installs: 3 252
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 2
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.3.2
- guzzle/guzzle: >=3.5,<4.0
- symfony/framework-bundle: >=2.1.0-dev,<4.0-dev
This package is auto-updated.
Last update: 2024-12-21 19:37:18 UTC
README
This bundle helps you integrating the Postcode.nl API into your Symfony project. With this integrated you can autocomplete street and places automaticly based on the user supploed postalcode and house number.
Installation
Add this bundle to your composer.json:
{
"require": {
"keesschepers/postcodenl-api-bundle": "dev-master"
}
}
Second, add the bundle to your AppKernel.php:
public function registerBundles()
{
$bundles = array(
// ...
new Keesschepers\PostcodenlApiBundle\KeesschepersPostcodenlApiBundle(),
);
}
Third, you need to configure the bundle by adding the following to your config.yml:
keesschepers_postcodenl_api:
base_url: "https://api.postcode.nl/rest/addresses"
timeout: 5
api_user: %keesschepers_postcodenl_api.api_user%
api_secret: %keesschepers_postcodenl_api.api_secret%
Where you can supply api_user and api_secret directly or like the example above in your parameters.yml (recommended).
And optionally import the routing.yml into your project:
keesschepers_postcodenl_api:
resource: "@KeesschepersPostcodenlApiBundle/Resources/config/routing.yml"
prefix: /
If you followed these steps correctly you should have access to the followin url:
http://your.project.local/app_dev.php/get-postalcode-details?zipcode=0000XX&address-number=XX
Advance usage
You can also use the service in your own controller:
$api = $this->get('keesschepers_postcodenl_api.api');
$response = $api->getResponseByPostcodeAndHousenumber($postalcode, $housenr);