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

29PHP

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 1mo 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

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

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

[jeroen/rewindable-generator

Provides a simple adapter to make generators rewindable

1655.4k2](/packages/jeroen-rewindable-generator)

PHPackages © 2026

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