PHP code example of hanhan / address-parser

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

    

hanhan / address-parser example snippets



hanhan\AddressParser\AddressParser;

$parser = new AddressParser(); // 默认读取包内 data/region 数据

$result = $parser->parseWithChunkTownships("北京市朝阳区建国路");
print_r($result);

$result = $parser->parseWithChunkTownships("某某新口岸", [
    "landmarks" => [
        [
            "name" => "某某新口岸",
            "aliases" => ["某某新"],
            "province" => "云南省",
            "city" => "临沧市",
            "district" => "某某县",
            "type" => "口岸",
        ],
    ],
]);