topkstt/laravel-thai-address

帮助泰国开发者构建地址数据库

1.0.1 2022-11-07 07:24 UTC

This package is auto-updated.

Last update: 2024-09-27 19:02:06 UTC


README

MIT License Latest Stable Version PHP Version Require Monthly Downloads

提供泰国地理数据库,如省份、区、次区以及为您的应用程序生成API路由。

功能

  • 泰国省份、区、次区和邮政编码数据库。
  • REST API 路由。
  • 支持UUID(在配置文件中设置)。

路线图

  • 添加英文名称
  • 添加经纬度信息
  • 添加地址提取器

要求

  • PHP 7.1 - 8.1
  • Laravel 7.0 - 9.0

安装

使用Composer安装Laravel Thai Address

composer require topkstt/laravel-thai-address

发布包配置文件

php artisan vendor:publish --provider="TopKSTT\ThaiAddress\ThaiAddressServiceProvider" --tag="config"

发布包迁移文件并迁移数据库

php artisan vendor:publish --provider="TopKSTT\ThaiAddress\ThaiAddressServiceProvider" --tag="migrations"
php artisan migrate

发布包迁移种子并播种数据库

php artisan vendor:publish --provider="TopKSTT\ThaiAddress\ThaiAddressServiceProvider" --tag="seeders"
php artisan db:seed --class=ThaiAddressTablesSeeder

API参考

  • 在调用API端点之前,请在thai_address.php配置文件中启用API配置。
  • 在调用API端点之前,请在thai_address.php配置文件中设置API路由前缀。
  • Postman收藏集 -> 点击这里

省份

获取所有省份

  GET /api/{YOUR_PREFIX_IF_SET}/province/all

通过ID获取省份

  GET /api/{YOUR_PREFIX_IF_SET}/province/${id}

按名称搜索省份

  GET /api/{YOUR_PREFIX_IF_SET}/province/search/${id}

获取所有区

  GET /api/{YOUR_PREFIX_IF_SET}/district/all

通过ID获取区

  GET /api/{YOUR_PREFIX_IF_SET}/district/${id}

按名称搜索区

  GET /api/{YOUR_PREFIX_IF_SET}/district/search/${id}

次区

获取所有次区

  GET /api/{YOUR_PREFIX_IF_SET}/sub-district/all

通过ID获取次区

  GET /api/{YOUR_PREFIX_IF_SET}/sub-district/${id}

按名称搜索次区

  GET /api/{YOUR_PREFIX_IF_SET}/sub-district/search/${id}

邮政编码

获取所有邮政编码

  GET /api/{YOUR_PREFIX_IF_SET}/postal-code/all

通过ID获取邮政编码

  GET /api/{YOUR_PREFIX_IF_SET}/postal-code/${id}

按名称搜索邮政编码

  GET /api/{YOUR_PREFIX_IF_SET}/postal-code/search/${id}