sqits/laravel-postcode is a Laravel package for laravel wrapper for the postcode-nl api.
It currently has 0 GitHub stars and 293 downloads on Packagist (latest version v0.1.4).
Install it with composer require sqits/laravel-postcode.
Discover more Laravel packages by sqits
or browse all Laravel packages to compare alternatives.
Last updated
This package requires PHP 7.2 and Laravel 5.8 or higher. Install the package by running the following command in your console;
composer require sqits/laravel-postcode
You can publish the config file with:
php artisan vendor:publish --provider="Sqits\Postcode\PostcodeServiceProvider" --tag="config"
This is the contents of the published config file:
/*
* Request options required for GuzzleHttp client.
*/
'requestOptions' => [
/*
* URI
*
* Settings which api url the package should use. There are several endpoints available
*/
'uri' => [
'extension' => env('POSTCODENL_URI_EXTENSION', 'nl'),
],
/*
* Authentication
*
* Register an account with Postcode.nl to obtain a key and secret. See https://api.postcode.nl/#register for
* further information.
*/
'auth' => [
env('POSTCODENL_KEY', null),
env('POSTCODENL_SECRET', null)
],
/*
* Timeout (in seconds)
*
* By default, the client waits 10 seconds for a response. You may set a different timeout.
*/
'timeout' => env('POSTCODENL_TIMEOUT', 10),
],
/*
* Enable routes
*
* This package comes with a set of routes, which are not loaded by default. In order to use them, set this
* option to true.
*/
'enableRoutes' => env('POSTCODENL_ENABLE_ROUTES', false),
In order to use the API, enabled it in the configuration. When enabled, the following route is available:
route('postcode-nl::address', [$postcode, $houseNumber, $houseNumberAddition = null]);
or use the following URL (e.g. for AJAX calls):
/postcode-nl/address/{postcode}/{houseNumber}/{houseNumberAddition?}
The key and secret are used for authentication. Without them, you cannot use the service.
POSTCODENL_KEY=<your-api-key>
POSTCODENL_SECRET=<your-secret>
This package comes with a ready to use JSON API, which is disabled by default. You can enable it like so:
POSTCODENL_ENABLE_ROUTES=true
By default, the client waits 10 seconds for a response. You may set a different timeout.
POSTCODENL_TIMEOUT=<timeout-in-seconds>
Please see CHANGELOG for more information what has changed recently.
If you discover any security-related issues, please email to [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.