PHP code example of hejunjie / address-parser

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

    

hejunjie / address-parser example snippets


use Hejunjie\AddressParser\AddressParser;

$raw = '张三,13512345678,410123199001011234 重庆攀枝花市东区机场路88号 邮编100000';

$parsed = AddressParser::parse($raw);

print_r($parsed);


[
    'name' => '张三',
    'mobile' => '13512345678',
    'idn' => '410123199001011234',
    'postcode' => '100000',
    'province' => '四川省',
    'city' => '攀枝花市',
    'region' => '东区',
    'street' => '机场路88号'
]