2017 © Pedro Peláez
 

yii2-extension yii2-location

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

image

ap369/yii2-location

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

  • Friday, September 22, 2017
  • by ap369
  • Repository
  • 2 Watchers
  • 2 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Yii2 location extension

Retrieve a user's location from their IP address using an external web services, (*1)

Installation

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

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

or add, (*4)

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

to the require section of your composer.json file., (*5)

Usage

Once the extension is installed, use it in your code like this:, (*6)

$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., (*7)

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

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

You can also pass null as the address to have it automatically resolved:, (*9)

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

Supported drivers

Currently, the following drivers are supported by this extension:, (*10)

  • IpInfo (default)
  • GeoPlugin
  • FreeGeoIp

Acknowledgment

This extension is based on stevebauman/location laravel extension., (*11)

The Versions

22/09 2017

dev-master

9999999-dev

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

  Sources   Download

MIT

The Requires

 

by Ahmed SAIDI

extension yii2 ip location