PHPackages                             justcy/iparse - 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. justcy/iparse

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

justcy/iparse
=============

ip parse to region for PHP

10PHPCI failing

Since Dec 4Pushed 6y ago1 watchersCompare

[ Source](https://github.com/justcy/iparse)[ Packagist](https://packagist.org/packages/justcy/iparse)[ RSS](/packages/justcy-iparse/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependenciesVersions (1)Used By (0)

本库基于 [ip2region](https://github.com/lionsoul2014/ip2region) ，简单整合方便使用`composer`来管理。
-----------------------------------------------------------------------------------

[](#本库基于-ip2region-简单整合方便使用composer来管理)

[ip2region](https://github.com/lionsoul2014/ip2region) - 最自由的ip地址查询库，ip到地区的映射库，提供Binary,B树和纯内存三种查询算法，妈妈再也不用担心我的ip地址定位。

### 1. 99.9%准确率，定时更新：

[](#1-999准确率定时更新)

数据聚合了一些知名ip到地名查询提供商的数据，这些是他们官方的的准确率，经测试着实比纯真啥的准确多了。
每次聚合一下数据需要1-2天，会不定时更新。

### 2. 标准化的数据格式：

[](#2-标准化的数据格式)

每条ip数据段都固定了格式：*城市Id|国家|区域|省份|城市|ISP*

只有中国的数据精确到了城市，其他国家只能定位到国家，后前的选项全部是0，已经包含了全部你能查到的大大小小的国家。 （请忽略前面的城市Id，个人项目需求）

### 3. 体积小：

[](#3-体积小)

数据库文件ip2region.db只有1.5M

### Composer 安装

[](#composer-安装)

```
composer require justcy/iparse

```

### 更新IP地址库

[](#更新ip地址库)

```
make update

```

### ip2region 使用

[](#ip2region-使用)

```
$ipParse = new iparse\Ip2Region();
$result = $ipParse->btreeSearch('101.105.35.57');

var_export($info, true);

// array (
//     'city_id' => 2163,
//     'region' => '中国|华南|广东省|深圳市|鹏博士',
//     'city_id'  => 2163,
//     'country'  => "中国",
//     'region'   => "华南",
//     'province' => "广东省",
//     'area'     => "深圳市",
//     'isp'      => "鹏博士",
// )
```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

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/1180f1d3de113af2a711865f4fd41e2ced1d864b98b9960d15e9b768543a61d4?d=identicon)[justcy](/maintainers/justcy)

### Embed Badge

![Health badge](/badges/justcy-iparse/health.svg)

```
[![Health](https://phpackages.com/badges/justcy-iparse/health.svg)](https://phpackages.com/packages/justcy-iparse)
```

PHPackages © 2026

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