You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An intelligent address parser that extracts name, phone number, ID number, region, and detailed address from unstructured text—perfect for e-commerce, logistics, and CRM systems.
A simple and practical PHP address parsing tool that can extract **name, phone number, ID card number, postal code, and full province-city-district address** from unstructured strings.
13
+
14
+
> 🚀 Ideal for use cases like shipping addresses and user information entry, automatically identifying and structuring key data.
8
15
9
-
支持批量查询
16
+
If you don’t want to deploy it yourself and just want to use it directly, you can 👉 [Click here to use it](https://tools.hejunjie.life/#/external/address-parser)
17
+
18
+
Batch queries are supported.
10
19
11
20
---
12
21
13
-
## ✨ 特性
22
+
## ✨ Features
14
23
15
-
-自动识别:支持姓名、手机号、身份证、邮编提取
16
-
-地址解析:基于省市区行政区划数据,智能匹配行政区域
17
-
-结构化返回:统一结构输出,便于前后端对接
18
-
-零依赖:纯 PHP 编写,无需额外扩展
19
-
-支持 PHP 8+
24
+
-Auto Recognition: Supports extraction of name, phone number, ID card, and postal code
25
+
-Address Parsing: Intelligently matches administrative regions based on province/city/district data
26
+
-Structured Output: Returns data in a unified structure, easy for frontend-backend integration
27
+
-Zero Dependencies: Written in pure PHP, no additional extensions required
28
+
- PHP 8+ Supported
20
29
21
30
---
22
31
23
-
## 📦 安装
32
+
## 📦 Installation
24
33
25
-
使用 Composer 安装:
34
+
Install via Composer:
26
35
27
36
```bash
28
37
composer require hejunjie/address-parser
29
38
```
30
39
31
-
## 🧠 使用示例
40
+
## 🧠 Usage Example
32
41
33
42
```php
34
43
use Hejunjie\AddressParser\AddressParser;
@@ -41,7 +50,7 @@ print_r($parsed);
41
50
42
51
```
43
52
44
-
输出结果
53
+
Output Result
45
54
46
55
```php
47
56
[
@@ -56,69 +65,73 @@ print_r($parsed);
56
65
]
57
66
```
58
67
59
-
## 🧩 返回字段说明
68
+
## 🧩 Response Field Description
60
69
61
-
|字段名|说明|
70
+
|Parameter|Description|
62
71
|:-------|:-----|
63
-
| name |姓名|
64
-
| mobile |手机号|
65
-
| idn |身份证号|
66
-
| postcode |邮政编码|
67
-
| province |省份名称|
68
-
| city |城市名称|
69
-
| region |区/县名称|
70
-
| street |详细地址(去除省市区后的部分)|
72
+
| name |User's full name|
73
+
| mobile |User's mobile number|
74
+
| idn |User's national ID card number|
75
+
| postcode |Zip/postal code|
76
+
| province |Name of the province|
77
+
| city |Name of the city|
78
+
| region |Name of the district or county|
79
+
| street |Remaining address after removing province, city, and district|
71
80
72
-
## 🧰 用途 & 背景
81
+
## 🧰 Purpose & Background
73
82
74
-
在实际业务中,用户填写的地址往往是非结构化的,例如:
83
+
In real-world scenarios, user-submitted addresses are often unstructured. For example:
Manually parsing such data is not only inefficient but also error-prone. The `hejunjie/address-parser` is designed specifically to solve this problem of **unstructured address parsing**, and is suitable for a wide range of use cases:
88
+
89
+
- 🛒 Processing order addresses in e-commerce systems
90
+
- 📦 Address recognition in logistics and delivery services
91
+
- 🧾 User profile completion in admin panels
92
+
- 📱 Address input validation in mini-programs or mobile apps
79
93
80
-
- 🛒 电商系统中的订单地址处理
81
-
- 📦 快递物流系统地址识别
82
-
- 🧾 后台管理系统用户信息补全
83
-
- 📱 小程序/APP 用户地址录入校验
94
+
Whether for personal projects or enterprise systems, it significantly boosts automation and accuracy in address handling.
84
95
85
-
无论是个人项目还是企业系统,它都能快速提升地址处理的自动化与准确率。
96
+
If you have any questions or suggestions, feel free to submit an issue or PR — I’ll do my best to respond.
The inspiration for this package originally came from a friend who mentioned the idea in an issue on one of my other repositories, even kindly sharing another friend's implementation: [pupuk/address](https://github.com/pupuk/address). I found the concept very interesting, and thanks to that inspiration, I created `hejunjie/address-parser`.
91
101
92
-
感谢他的思路分享,也希望这个小工具能帮到更多人 🙌
102
+
Thanks to him for the idea — I hope this little tool helps more people 🙌
93
103
94
-
## 🔧 更多工具包(可独立使用,也可统一安装)
104
+
## 🔧 Additional Toolkits (Can be used independently or installed together)
This project was originally extracted from [hejunjie/tools](https://github.com/zxc7563598/php-tools).
107
+
To install all features in one go, feel free to use the all-in-one package:
97
108
98
109
```bash
99
110
composer require hejunjie/tools
100
111
```
101
112
102
-
当然你也可以按需选择安装以下功能模块:
113
+
Alternatively, feel free to install only the modules you need:
114
+
115
+
[hejunjie/utils](https://github.com/zxc7563598/php-utils) - A lightweight and practical PHP utility library that offers a collection of commonly used helper functions for files, strings, arrays, and HTTP requests—designed to streamline development and support everyday PHP projects.
[hejunjie/cache](https://github.com/zxc7563598/php-cache) - A layered caching system built with the decorator pattern. Supports combining memory, file, local, and remote caches to improve hit rates and simplify cache logic.
[hejunjie/china-division](https://github.com/zxc7563598/php-china-division) - Regularly updated dataset of China's administrative divisions with ID-card address parsing. Distributed via Composer and versioned for use in forms, validation, and address-related features
[hejunjie/error-log](https://github.com/zxc7563598/php-error-log) - An error logging component using the Chain of Responsibility pattern. Supports multiple output channels like local files, remote APIs, and console logs—ideal for flexible and scalable logging strategies.
[hejunjie/mobile-locator](https://github.com/zxc7563598/php-mobile-locator) - A mobile number lookup library based on Chinese carrier rules. Identifies carriers and regions, suitable for registration checks, user profiling, and data archiving.
[hejunjie/address-parser](https://github.com/zxc7563598/php-address-parser) - An intelligent address parser that extracts name, phone number, ID number, region, and detailed address from unstructured text—perfect for e-commerce, logistics, and CRM systems.
[hejunjie/url-signer](https://github.com/zxc7563598/php-url-signer) - A PHP library for generating URLs with encryption and signature protection—useful for secure resource access and tamper-proof links.
115
128
116
-
[hejunjie/google-authenticator](https://github.com/zxc7563598/php-google-authenticator) - Google Authenticator 及类似应用的密钥生成、二维码创建和 OTP 验证。
129
+
[hejunjie/google-authenticator](https://github.com/zxc7563598/php-google-authenticator) - A PHP library for generating and verifying Time-Based One-Time Passwords (TOTP). Compatible with Google Authenticator and similar apps, with features like secret generation, QR code creation, and OTP verification.
[hejunjie/simple-rule-engine](https://github.com/zxc7563598/php-simple-rule-engine) - A lightweight and flexible PHP rule engine supporting complex conditions and dynamic rule execution—ideal for business logic evaluation and data validation.
119
132
120
-
👀 所有包都遵循「轻量实用、解放双手」的原则,能单独用,也能组合用,自由度高,欢迎 star 🌟 或提 issue。
133
+
👀 All packages follow the principles of being lightweight and practical — designed to save you time and effort. They can be used individually or combined flexibly. Feel free to ⭐ star the project or open an issue anytime!
This library will continue to be updated with more practical features. Suggestions and feedback are always welcome — I’ll prioritize new functionality based on community input to help improve development efficiency together.
"description": "An intelligent address parser that extracts name, phone number, ID number, region, and detailed address from unstructured text—perfect for e-commerce, logistics, and CRM systems.",
0 commit comments