PHPackages                             dpodium/yii2-geoip - 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. dpodium/yii2-geoip

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

dpodium/yii2-geoip
==================

Yii2 Component to allow for easy usage of the MaxMind Free dbs.

2.1.22(1y ago)835.2k—9.6%3[2 issues](https://github.com/dpodium/yii2-geoip/issues)1MITPHP

Since Nov 13Pushed 1y ago5 watchersCompare

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

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

Yii2 GeoIP
==========

[](#yii2-geoip)

Yii2 Component to allow for easy usage of the MaxMind Free dbs.

Based on package phiphi1992/Yii2-GeoIP by Phi Hoang Xuan.

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

[](#installation)

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

Either run

```
php composer.phar require dpodium/yii2-geoip "~2.0.0"

```

or add

```
"dpodium/yii2-geoip": "~2.0.0"

```

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

Version ~2.0.0 Difference
-------------------------

[](#version-200-difference)

Version ~2.0.0 uses the new GeoLite2 version of the db instead of the Legacy GeoLite which is now deprecated.

Database can be found here:

Component Setup
---------------

[](#component-setup)

Once the extension is installed, simply modify your application configuration as follows:

```
return [
    'components' => [
    ...
        'geoip' => [
            'class' => 'dpodium\yii2\geoip\components\CGeoIP',
            'support_ipv6' => false, //Default value
        ],
        ...
    ],
    ...
];
```

If querying full City data is required, yii2-geoip-city-db must be required as well, see [dpodium/yii2-geoip-city-db](https://github.com/dpodium/yii2-geoip-city-db).

For more information on the data availability, see below.

Usage
-----

[](#usage)

All methods accept an IP address as an argument. If no argument is supplied Yii::$app-&gt;getRequest()-&gt;getUserIP() is used.

```
//Along with free DB
$location = Yii::$app->geoip->lookupLocation();
$countryCode = Yii::$app->geoip->lookupCountryCode();
$countryName = Yii::$app->geoip->lookupCountryName();

```

Location attributes:

```
$location->countryCode //Available in both Country and City DB
$location->countryName //Available in both Country and City DB
$location->continentCode //Available in both Country and City DB
$location->continentName //Available in both Country and City DB
$location->city //Available in only City DB
$location->postalCode //Available in only City DB
$location->latitude //Available in only City DB
$location->longitude //Available in only City DB
$location->timeZone //Available in only City DB

```

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance42

Moderate activity, may be stable

Popularity35

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~101 days

Total

73

Last Release

396d ago

Major Versions

1.3.9 → 2.0.02018-06-12

### Community

Maintainers

![](https://www.gravatar.com/avatar/c7d4729d14d133df43f29028b24bdf23a9ceadbc94012de1b7ec02ce58c55e02?d=identicon)[dpodium](/maintainers/dpodium)

---

Top Contributors

[![ierawahid](https://avatars.githubusercontent.com/u/32503537?v=4)](https://github.com/ierawahid "ierawahid (32 commits)")[![darrenng-dpodium](https://avatars.githubusercontent.com/u/12998063?v=4)](https://github.com/darrenng-dpodium "darrenng-dpodium (24 commits)")[![sionghuat](https://avatars.githubusercontent.com/u/13095881?v=4)](https://github.com/sionghuat "sionghuat (20 commits)")[![chingyen29](https://avatars.githubusercontent.com/u/54927097?v=4)](https://github.com/chingyen29 "chingyen29 (2 commits)")[![weichen-dpodium](https://avatars.githubusercontent.com/u/19607266?v=4)](https://github.com/weichen-dpodium "weichen-dpodium (2 commits)")[![domong14](https://avatars.githubusercontent.com/u/177703636?v=4)](https://github.com/domong14 "domong14 (1 commits)")

---

Tags

geoipmaxmindyii2extension

### Embed Badge

![Health badge](/badges/dpodium-yii2-geoip/health.svg)

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

###  Alternatives

[dmstr/yii2-cookie-consent

Yii2 Cookie Consent Widget

1455.6k](/packages/dmstr-yii2-cookie-consent)[imanilchaudhari/yii2-currency-converter

This extension will help to find out current currency conversion rate.

2111.7k](/packages/imanilchaudhari-yii2-currency-converter)[richardfan1126/yii2-js-register

Yii2 widget to register JS into view

1359.3k7](/packages/richardfan1126-yii2-js-register)

PHPackages © 2026

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