PHPackages                             chinapostm/address-parser - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. chinapostm/address-parser

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

chinapostm/address-parser
=========================

收货地址智能解析工具，支持从非结构化文本中提取姓名、手机号、身份证号、省市区、详细地址等字段，适用于电商、物流、CRM 等系统 | 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.

00PHP

Since Aug 10Pushed 9mo agoCompare

[ Source](https://github.com/chinapostm/php-address-parser)[ Packagist](https://packagist.org/packages/chinapostm/address-parser)[ RSS](/packages/chinapostm-address-parser/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

hejunjie/address-parser
=======================

[](#hejunjieaddress-parser)

 [English](./README.md)｜[简体中文](./README.zh-CN.md)---

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.

**This project has been parsed by Zread. If you need a quick overview of the project, you can click here to view it：[Understand this project](https://zread.ai/zxc7563598/php-address-parser)**

---

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.

> 🚀 Ideal for use cases like shipping addresses and user information entry, automatically identifying and structuring key data.

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)

Batch queries are supported.

---

✨ Features
----------

[](#-features)

- Auto Recognition: Supports extraction of name, phone number, ID card, and postal code
- Address Parsing: Intelligently matches administrative regions based on province/city/district data
- Structured Output: Returns data in a unified structure, easy for frontend-backend integration
- Zero Dependencies: Written in pure PHP, no additional extensions required
- PHP 8+ Supported

---

📦 Installation
--------------

[](#-installation)

Install via Composer:

```
composer require chinapostm/address-parser
```

🧠 Usage Example
---------------

[](#-usage-example)

```
use Hejunjie\AddressParser\AddressParser;

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

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

print_r($parsed);
```

Output Result

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

🧩 Response Field Description
----------------------------

[](#-response-field-description)

ParameterDescriptionnameUser's full namemobileUser's mobile numberidnUser's national ID card numberpostcodeZip/postal codeprovinceName of the provincecityName of the cityregionName of the district or countystreetRemaining address after removing province, city, and district🧰 Purpose &amp; Background
--------------------------

[](#-purpose--background)

In real-world scenarios, user-submitted addresses are often unstructured. For example:

> 张三 13512345678 北京市朝阳区建国路88号 邮编100000

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:

- 🛒 Processing order addresses in e-commerce systems
- 📦 Address recognition in logistics and delivery services
- 🧾 User profile completion in admin panels
- 📱 Address input validation in mini-programs or mobile apps

Whether for personal projects or enterprise systems, it significantly boosts automation and accuracy in address handling.

If you have any questions or suggestions, feel free to submit an issue or PR — I’ll do my best to respond.

🙏 Acknowledgements
------------------

[](#-acknowledgements)

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`.

Thanks to him for the idea — I hope this little tool helps more people 🙌

🔧 Additional Toolkits (Can be used independently or installed together)
-----------------------------------------------------------------------

[](#-additional-toolkits-can-be-used-independently-or-installed-together)

This project was originally extracted from [hejunjie/tools](https://github.com/zxc7563598/php-tools). To install all features in one go, feel free to use the all-in-one package:

```
composer require hejunjie/tools
```

Alternatively, feel free to install only the modules you need：

[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.

[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.

👀 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.

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance41

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 Bus Factor1

Top contributor holds 80% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/b954b1e9e1a3f17f6d412aed8d3c36b94043afafb6c83dc1dbe2bd6065b4a98c?d=identicon)[chinapostm](/maintainers/chinapostm)

---

Top Contributors

[![chinapostm](https://avatars.githubusercontent.com/u/75209261?v=4)](https://github.com/chinapostm "chinapostm (4 commits)")[![zxc7563598](https://avatars.githubusercontent.com/u/46590942?v=4)](https://github.com/zxc7563598 "zxc7563598 (1 commits)")

### Embed Badge

![Health badge](/badges/chinapostm-address-parser/health.svg)

```
[![Health](https://phpackages.com/badges/chinapostm-address-parser/health.svg)](https://phpackages.com/packages/chinapostm-address-parser)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
