sqits/laravel-postcode
最新稳定版本:v0.1.4
Composer 安装命令:
composer require sqits/laravel-postcode
包简介
Laravel wrapper for the postcode-nl api
README 文档
README
Installation and usage
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),
Using the JSON API
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?}
Configuration
Credentials (required)
The key and secret are used for authentication. Without them, you cannot use the service.
POSTCODENL_KEY=<your-api-key> POSTCODENL_SECRET=<your-secret>
Enable routes (optional)
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
Timeout (in seconds, optional)
By default, the client waits 10 seconds for a response. You may set a different timeout.
POSTCODENL_TIMEOUT=<timeout-in-seconds>
Changelog
Please see CHANGELOG for more information what has changed recently.
Security
If you discover any security-related issues, please email to info@sqits.nl instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 254
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-10-09