sukohi/laravel-jp-postal-code
Composer 安装命令:
composer require sukohi/laravel-jp-postal-code
包简介
A Laravel package that allows you to search address with Japanese postal code.
README 文档
README
A Laravel package that allows you to search address with Japanese postal code.
(This package is maintained under Laravel 5.7.)
Installation
Run the following command.
composer require sukohi/laravel-jp-postal-code:1.*
Preparation
The migration file is automatically loaded.
So just run this command.
php artisan migrate
And download "ken_all.zip" from the below by clicking "全国一括".
Set a csv file in /storage/app/csv/KEN_ALL.CSV after unzip.
Now the time to import postal data.
Run this command.
php artisan import:jp-postal-code
Note: Import takes time because the csv file has over 120,000 lines.
Configuration
If you'd like to configure, publish jp_postal_code.php.
php artisan vendor:publish --provider="Sukohi\LaravelJpPostalCode\LaravelJpPostalCodeServiceProvider"
Now you have jp_postal_code.php in /config folder.
endpoint
This is URL that provides feature of address search.
So you can search Japanese address as follows though Ajax.
- /api/jp_postal_code?code=131-0045
- /api/jp_postal_code?first_code=131&last_code=0045
Multi-byte character like "1310045" is also available.
[Response example]
{
address: "押上"
city: "墨田区"
first_code: "131"
full_address: "〒131-0045 東京都墨田区押上"
full_code: "131-0045"
id: 39342
last_code: "0045"
prefecture: "東京都"
}
- You can change format of
full_addressandfull_codein/config/jp_postal_code.php.
import_path
The path of "KEN_ALL.CSV".
address_format
The format of full_address when retrieving address.
postal_code_format
The format of full_code when retrieving address.
License
This package is licensed under the MIT License. Copyright 2019 Sukohi Kuhoh
sukohi/laravel-jp-postal-code 适用场景与选型建议
sukohi/laravel-jp-postal-code 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.43k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2019 年 12 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 sukohi/laravel-jp-postal-code 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sukohi/laravel-jp-postal-code 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.43k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-12-10