承接 mmerlijn/laravel-postcode 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mmerlijn/laravel-postcode

最新稳定版本:v3.0.3

Composer 安装命令:

composer create-project mmerlijn/laravel-postcode

包简介

Laravel postcode nl helper package

README 文档

README

Installation

Install package
composer require mmerlijn/laravel-postcode
Optional Publish config file (for customisation)
php artisan vendor:publish --provider="mmerlijn\LaravelPostcodeServiceProvider" --tag="config"

database_connection_name => default: mysql_postcode
postcode_table_name => default: postcode_nl
postcode_table_not_found =>default: postcode_not_found

route.prefix    => default: postcode
route.middleware => default: ['web']

Usage

Postcode request

POST: ../postcode/getAddress {city:...,building:...}

//Required: city and building

Response

//on success example
status:200
data:{
    "postcode": "1187LS"
    "nr": "3 a"
    "building_nr": "3"
    "building_addition": "a"
    "street": "Westwijkplein"
    "city": "Amstelveen"
    "province": "Noord-Holland"
    "lat": "52.281458330925"
    "long": "4.8261185828603"
    "success": true
    "error": null
}
//on not found failure example
status:200
data:{
    "postcode": "1187LS"
    "nr": "3 a"
    "building_nr": "3"
    "building_addition": "a"
    "street": ""
    "city": ""
    "province": ""
    "lat": ""
    "long": ""
    "success": false
    "error": 'Postcode not found'
}
//on invalid request
status:422
Usual laravel validation errors

Usefull methods

Scopes

$p = Postcode::getAddress($city,$building)->first();

Static methods

$c = Postcode::getCity($postcode); //returns name of city or empty string

$c = Postcode::getCityCoordinates($city); // return array ['lat'=>...,'long'=>...]
$c = Postcode::getPostcodeCoordinates($postcode); // return array ['lat'=>...,'long'=>...]
$c = Postcode::getCoordinates(postcode/city);  // return array ['lat'=>...,'long'=>...]

统计信息

  • 总下载量: 44
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-01-10