PHP code example of zifan / addressparser

1. Go to this page and download the library: Download zifan/addressparser library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

zifan / addressparser example snippets

 PHP
[
    'dataProvider' => [
        'driver' => 'file'            // 驱动,默认file,其它方式(如数据模型)可自行扩展
        'path' => null,               // 指定省市区数据文件,默认从插件config文件夹中读取
    ],
    'enable_keywords_split' => false, // 是否启用关键词分割(适用于在淘宝、京东App上复制收货地址时开启,固定格式,拼多多不带关键字只是格式固定)
    'keywords' => [                   // enable_keywords_split 为 true 时才生效
        'person' => ['收货人', '收件人', '姓名'],
        'mobile' => ['手机号码', '手机', '联系方式', '电话号码', '电话'],
    ],
    'extra' => [                      // 额外提取字段
        'sub_district' => false,      // 村乡镇/街道(准确度低)
        'idn' => false,               // 身份证号
        'mobile' => false,            // 联系方式(手机号/座机号)
        'postcode' => false,          // 邮编
        'person' => false,            // 姓名(准确度低)
    ],
    'strict' => false,                // 是否对提取结果进行准确度校验、补齐
]