PHPackages                             juckzhang/yii2-ip-look-up - 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. juckzhang/yii2-ip-look-up

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

juckzhang/yii2-ip-look-up
=========================

QQWry、upLookup、ipToCity integration for the Yii2 framework

1.0.1(9y ago)28BSD-3-ClausePHPPHP &gt;=5.4.0

Since Apr 21Pushed 9y ago1 watchersCompare

[ Source](https://github.com/juckzhang/yii2-ip-look-up)[ Packagist](https://packagist.org/packages/juckzhang/yii2-ip-look-up)[ RSS](/packages/juckzhang-yii2-ip-look-up/feed)WikiDiscussions master Synced 6d ago

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

根据ip获取对应的城市名称 Extension for Yii2
================================

[](#根据ip获取对应的城市名称-extension-for-yii2)

根据ip获取对应的城市名称 qqwry QQWry

[![Latest Stable Version](https://camo.githubusercontent.com/ee82fcded207935cb7750efcbaa08a458a1954a335132f2988d15165947cd583/68747470733a2f2f706f7365722e707567782e6f72672f6a75636b7a68616e672f796969322d69702d6c6f6f6b2d75702f76657273696f6e)](https://packagist.org/packages/juckzhang/yii2-ip-look-up)[![Total Downloads](https://camo.githubusercontent.com/f32ed5d3aaf9f09f2b33434450030c65807f1725d12caed900aac17417ce5824/68747470733a2f2f706f7365722e707567782e6f72672f6a75636b7a68616e672f796969322d69702d6c6f6f6b2d75702f646f776e6c6f616473)](https://packagist.org/packages/juckzhang/yii2-ip-look-up)[![License](https://camo.githubusercontent.com/f24ec91fbbd1d1b5a7f2e414bae0531b24736d8d48ab367742156b8195b74253/68747470733a2f2f706f7365722e707567782e6f72672f6a75636b7a68616e672f796969322d69702d6c6f6f6b2d75702f6c6963656e7365)](https://packagist.org/packages/juckzhang/yii2-ip-look-up)

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
composer require juckzhang/yii2-ip-look-up:*

```

or add

```
"juckzhang/yii2-ip-look-up": "*"
```

to the `require` section of your composer.json.

Configuration
-------------

[](#configuration)

To use this extension, simply add the following code in your application configuration:

#### \[配置\]

[](#配置)

```
/** QiNiu **/
return [
    'components' => [
      'ipLookUp' => [
          'class' => 'juckzhang\ipLookUp\IpLookUp',
          'file'  => 'qqwry.dat'//纯真ip库文件地址
    ],
]
```

#### \[使用\]

[](#使用)

```
1、更新纯真ip库文件
\Yii::$app->get('ipLookUp')->updateQqWryFile();

2、根据ip返回城市信息
\Yii::$app->get('ipLookUp')->ipLookUp($ip);
```

Tricks
------

[](#tricks)

- 给配置的组件加 IDE 自动补全 [IDE autocompletion for custom components](https://github.com/samdark/yii2-cookbook/blob/master/book/ide-autocompletion.md)

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

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 ~3 days

Total

2

Last Release

3358d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/13914413?v=4)[marmot](/maintainers/juckzhang)[@juckzhang](https://github.com/juckzhang)

---

Tags

helperIPyii2extensionqqwryjuckzhangipLookUp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/juckzhang-yii2-ip-look-up/health.svg)

```
[![Health](https://phpackages.com/badges/juckzhang-yii2-ip-look-up/health.svg)](https://phpackages.com/packages/juckzhang-yii2-ip-look-up)
```

PHPackages © 2026

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