PHPackages                             myweishanli/yii2-ip2location - 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. myweishanli/yii2-ip2location

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

myweishanli/yii2-ip2location
============================

Yii2 Ip to Location

1.0.0(10y ago)311.8k↓80%62MITPHPPHP &gt;=5.4.0

Since May 17Pushed 10y ago2 watchersCompare

[ Source](https://github.com/myweishanli/yii2-ip2location)[ Packagist](https://packagist.org/packages/myweishanli/yii2-ip2location)[ RSS](/packages/myweishanli-yii2-ip2location/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (1)Versions (2)Used By (2)

Yii2 Ip to Location
===================

[](#yii2-ip-to-location)

安装
--

[](#安装)

安装这个扩展的首选方式是通过 [composer](http://getcomposer.org/download/).

执行

```
composer require --prefer-dist myweishanli/yii2-ip2location
```

或添加

```
"myweishanli/yii2-ip2location": "~1.0.0"

```

根据IP查询
------

[](#根据ip查询)

```
use \wsl\ip2location\Ip2Location;

$ipLocation = new Ip2Location();
$locationModel = $ipLocation->getLocation('8.8.8.8');
print_r($locationModel->toArray());
// Array
// (
//     [ip] => 8.8.8.8
//     [begin_ip] => 8.8.8.8
//     [end_ip] => 8.8.8.8
//     [country] => 美国
//     [area] => 加利福尼亚州圣克拉拉县山景市谷歌公司DNS服务器
// )
```

升级数据库
-----

[](#升级数据库)

```
use \wsl\ip2location\QQWry;

$qqwry = new QQWry();
$qqwry->upgrade();
```

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

3697d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4fde5dfb0db8e7ed2a2f3b9a4a0d21cabb34c77df28a94d6471b1b5b4db754e5?d=identicon)[myweishanli](/maintainers/myweishanli)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/myweishanli-yii2-ip2location/health.svg)

```
[![Health](https://phpackages.com/badges/myweishanli-yii2-ip2location/health.svg)](https://phpackages.com/packages/myweishanli-yii2-ip2location)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M2.9k](/packages/craftcms-cms)

PHPackages © 2026

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