Download the PHP package hurnell/postcode-api-bundle without Composer
On this page you can find all versions of the php package hurnell/postcode-api-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hurnell/postcode-api-bundle
More information about hurnell/postcode-api-bundle
Files in hurnell/postcode-api-bundle
Package postcode-api-bundle
Short Description Symfony 4 bundle for postcodeapi.nu
License MIT
Informations about the package postcode-api-bundle
postcode-api-bundle
A Symfony 4 bundle to access Dutch postcode API at Postcode API (postcodeapi.nu). Creates a PostcodeModel object based on postcode, house number & number extra combination.
Characteristics/Requirements
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
- Download via composer.
- Enable bundle by adding class reference to config/bundles.php (if composer did not do that for you).
- Create yaml configuration config/packages/hurnell_postcode_api.yaml with reference to your api_key.
1 - Download via composer
2 - Enable bundle
3 - Configure with API key
Usage
Autowiring is enabled by default so in a controller action (or constructor of other classes)
Handling InvalidNumberExtraException
Note that an invalid number extra value is not critical. Furthermore the api is not flawless; there are omissions for house number extra.
The method populatePostcodeModelWithoutExtra exists for these situations:
All versions of postcode-api-bundle with dependencies
ext-json Version *
galbar/jsonpath Version ^1.0
guzzlehttp/guzzle Version ^6.0
symfony/http-foundation Version ^4.0
symfony/config Version ^4.0
symfony/dependency-injection Version ^4.0
symfony/http-kernel Version ^4.0