firezihai/address-smart-parse
最新稳定版本:v1.0.0
Composer 安装命令:
composer require firezihai/address-smart-parse
包简介
地址智能识别
README 文档
README
使用默认数据源
$address = '18000000000 贵州黔南州平塘县卡蒲毛南族乡河中村 李子海 '; $smartParse = new AddressSmartParse(); $res = $smartParse->parse($address); print_r($res); //output: /* Array ( [province] => 贵州省 [city] => 黔南布依族苗族自治州 [district] => 平塘县 [town] => 卡蒲毛南族乡 [mobile] => 18000000000 [name] => 李子海 [address] => 河中村 ) */
自定义数据源
class RegionService { public function getRegion($regionName) { $region = Region::query()->where('name','=',$name)->first(['id','name','parent_id']); return $region ? $region->toArray() : ''; } } $service = new RegionService(); $address = '18000000000 广东省中山市南头镇南头大道中59号 '; $service = new RegionService(); $smartParse = new AddressSmartParse([$service,'getRegion']); $res = $smartParse->parse($address); print_r($res); //output: /* Array ( [province] => 广东省 [city] => 中山市 [district] => [town] => 南头镇 [mobile] => 18000000000 [name] => 李子海 [address] => 南头大道中59号 ) */
统计信息
- 总下载量: 10
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-12-16