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

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

xiaopig123456/yii2-ip2location
==============================

Yii2 Ip to Location

1.0.0(9y ago)0111MITPHPPHP &gt;=5.4.0

Since May 17Pushed 4y agoCompare

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

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

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

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

安装
--

[](#安装)

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

执行

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

根据IP查询
------

[](#根据ip查询)

```
use \wsl\ip2location\Ip2Location;
// 查询ip
$ipAddress = Ip2Location::getIpAddress();
echo $ipAddress;
// 8.8.8.8

// 根据查询地址
$locationModel = Ip2Location::getIpAddress($ipAddress);
print_r($locationModel->toArray());
// Array
// (
//     [country] => 美国
//     [province] => null
//     [city] => null
//     [description] => 加利福尼亚州圣克拉拉县山景市谷歌公司DNS服务器
// )
```

数据库最新版本
-------

[](#数据库最新版本)

数据库最后更新版本2022年2月9日

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

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

3648d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/569054cfa4313b2d246c41bf39ab3a929c5b843e1c617c8ab81d9c95e94e3bb7?d=identicon)[xiaopig123456](/maintainers/xiaopig123456)

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[dmstr/yii2-cookie-consent

Yii2 Cookie Consent Widget

1452.6k](/packages/dmstr-yii2-cookie-consent)

PHPackages © 2026

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