PHPackages                             sunsgne/ip-attribution - 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. sunsgne/ip-attribution

AbandonedArchivedLibrary

sunsgne/ip-attribution
======================

Webman plugin workbunny/ip-attribution

0.1.0(3y ago)05MITPHPPHP &gt;=7.4

Since Sep 15Pushed 3y ago1 watchersCompare

[ Source](https://github.com/sunsgneayo/ip-location)[ Packagist](https://packagist.org/packages/sunsgne/ip-attribution)[ RSS](/packages/sunsgne-ip-attribution/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (2)Versions (4)Used By (0)

[![workbunny](https://camo.githubusercontent.com/e2b1164338390ab45783434659e3e419e0c3b50fbe140c697ba1f82f59015ad6/68747470733a2f2f6368617a366368657a2e636e2f696d616765732f776f726b62756e6e792d6c6f676f2e706e67)](https://camo.githubusercontent.com/e2b1164338390ab45783434659e3e419e0c3b50fbe140c697ba1f82f59015ad6/68747470733a2f2f6368617a366368657a2e636e2f696d616765732f776f726b62756e6e792d6c6f676f2e706e67)

**workbunny/ip-attribution**

**🐇 geoip2 is applied to PHP to obtain IP geographic location. 🐇**

geoip2 is applied to PHP to obtain IP geographic location
=========================================================

[](#geoip2-is-applied-to-php-to-obtain-ip-geographic-location)

简介
--

[](#简介)

- `libs/mmdb`最后更新时间：2022-09-14
- `ip-attribution` 是基于`geoip2`作为底层，依托`mmdb`查询ip归属地及asn信息
- 本项目来源于[geoip2/geoip2](https://github.com/maxmind/GeoIP2-php)，感谢[MaxMind](https://github.com/maxmind) 工作组的开源

安装
--

[](#安装)

```
composer require workbunny/ip-attribution
```

使用
--

[](#使用)

### 范例

[](#范例)

```
use workbunny\IpLocation\Location;

try {

    $location = Location::$instance;

    var_dump($location->city("1.1.1.1"));

 }catch (\workbunny\IpLocation\exception\IpLocationException $exception){

 }
```

### 获取IP所在城市

[](#获取ip所在城市)

```
use workbunny\IpLocation\Location;

try {
   $location = new Location();
    var_dump($location->city("1.1.1.1"));

 }catch (\workbunny\IpLocation\exception\IpLocationException $exception){

 }
```

### 获取IP地址ASN信息

[](#获取ip地址asn信息)

```
use workbunny\IpLocation\Location;

try {
    $location = new Location();
    var_dump($location->asn("1.1.1.1"));
 }catch (\workbunny\IpLocation\exception\IpLocationException $exception){

 }
```

### 获取IP所在国家

[](#获取ip所在国家)

```
use workbunny\IpLocation\Location;

try {
    $location = new Location();
    var_dump($location->country("1.1.1.1"));
 }catch (\workbunny\IpLocation\exception\IpLocationException $exception){

 }
```

webman 中使用
----------

[](#webman-中使用)

### config配置文件

[](#config配置文件)

```
return [
    'enable' => true,
    //加载配置项
    'config'  => "default",
    'default' => [
        //语言
        "language" => ['zh-CN'],
        //mdb数据路径,(默认不指定，加载包内库)
        "mdbFileDir" => "",
        //未获取时默认标识
        "defaultIdentifier" => "NON"
    ],
];
```

### 应用

[](#应用)

```
use workbunny\IpLocation\Location;

try {
    $location = G(Location::class);
    var_dump($location->country("1.1.1.1"));
    var_dump($location->asn("1.1.1.1"));
    var_dump($location->city("1.1.1.1"));
 }catch (\workbunny\IpLocation\exception\IpLocationException $exception){

 }
```

### 运行

[](#运行)

```
./webman start
OR
php start.php start
```

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

1332d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/65843af70bae47cda80e0386c0640e2e17e1f8c8a12ea8fade3e1297237b26f3?d=identicon)[sunsgneayo](/maintainers/sunsgneayo)

---

Top Contributors

[![sunsgneayo](https://avatars.githubusercontent.com/u/51745500?v=4)](https://github.com/sunsgneayo "sunsgneayo (4 commits)")

### Embed Badge

![Health badge](/badges/sunsgne-ip-attribution/health.svg)

```
[![Health](https://phpackages.com/badges/sunsgne-ip-attribution/health.svg)](https://phpackages.com/packages/sunsgne-ip-attribution)
```

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.4k37.3k](/packages/matomo-matomo)[stevebauman/location

Retrieve a user's location by their IP Address

1.3k7.6M65](/packages/stevebauman-location)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

4.8k4.3k](/packages/shlinkio-shlink)[pulkitjalan/ip-geolocation

IP Geolocation Wrapper with Laravel Support

89164.9k1](/packages/pulkitjalan-ip-geolocation)[cravler/maxmind-geoip-bundle

Bundle integrating MaxMind GeoIP2 database into symfony application

27615.8k2](/packages/cravler-maxmind-geoip-bundle)

PHPackages © 2026

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