PHP code example of soul / address-parse

1. Go to this page and download the library: Download soul/address-parse 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/ */

    

soul / address-parse example snippets


$address    = '身份证号:51250119910927226x 收货地址张三收货地址:成都市武侯区美领馆路11号附2号 617000  136-3333-6666 ';
$gd_key     = '******' //高德开放平台(https://lbs.amap.com/)key 非必填 (使用后可提高识别精度)
$res        = AddressParse::getDetail($address,$gd_key)

[
    'name'              => '张三',
    'mobile'            => 13633336666,
    'id_card'           => '51250119910927226X',
    'zip_code'          => 617000,
    'province'          => [
        'code' => 510000,
        'name' => '四川省',
    ],
    'city'              => [
        'code' => 510100,
        'name' => '成都市',
    ],
    'district'          => [
        'code' => 510107,
        'name' => '武侯区',
    ],
    'formatted_address' => '美领馆路11号附2号'
];