PHPackages                             ap369/yii2-location - 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. ap369/yii2-location

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

ap369/yii2-location
===================

Yii2 location extension, retrieve a user's location from their IP address using an external web services

19PHP

Since Sep 22Pushed 8y ago1 watchersCompare

[ Source](https://github.com/ap369/yii2-location)[ Packagist](https://packagist.org/packages/ap369/yii2-location)[ RSS](/packages/ap369-yii2-location/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Yii2 location extension
=======================

[](#yii2-location-extension)

Retrieve a user's location from their IP address using an external web services

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

[](#installation)

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

Either run

```
php composer.phar require ap369/yii2-location dev-master

```

or add

```
"ap369/yii2-location": "dev-master"

```

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

Usage
-----

[](#usage)

Once the extension is installed, use it in your code like this:

```
$position = Location::get('44.85.3.2');

echo $position->latitude;
echo $position->longitude;
```

If you don't provide an IP address, it will default to `Yii::$app->request->userIP`.

Additionally, you can chose what driver will be used to resolve the IP address location, by passing its class as the second parameter.

```
$position =  Location::get('44.85.3.2', FreeGeoIp::class);
```

You can also pass `null` as the address to have it automatically resolved:

```
$position =  Location::get(null,GeoPlugin::class); // position from GeoPluin
```

Supported drivers
-----------------

[](#supported-drivers)

Currently, the following drivers are supported by this extension:

- IpInfo (default)
- GeoPlugin
- FreeGeoIp

Acknowledgment
--------------

[](#acknowledgment)

This extension is based on [stevebauman/location](https://github.com/stevebauman/location) laravel extension.

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

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

### Community

Maintainers

![](https://www.gravatar.com/avatar/9e7ef898cf1dd12a947be0b2a6fc54a828807789cfc74da4605f86f053366a27?d=identicon)[ap369](/maintainers/ap369)

---

Top Contributors

[![ap369](https://avatars.githubusercontent.com/u/6461823?v=4)](https://github.com/ap369 "ap369 (13 commits)")[![machour](https://avatars.githubusercontent.com/u/304450?v=4)](https://github.com/machour "machour (1 commits)")

### Embed Badge

![Health badge](/badges/ap369-yii2-location/health.svg)

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

###  Alternatives

[cheprasov/php-parallel

The class allows you to run multiple operations parallel in different processes and send results to the main process. Useful if you need to run multiple independent operations simultaneously, instead of sequential execution, or if you run several independent queries, for example, queries to different data bases

1712.5k5](/packages/cheprasov-php-parallel)[divante-ltd/pimcore5-clipboard

Clipboard Bundle for Pimcore 5. Adding objects to the special clipboard give you possibility to make actions only on some marked by you objects.

101.6k](/packages/divante-ltd-pimcore5-clipboard)

PHPackages © 2026

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