This library uses Sypex GeoCity database by default.
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist kwazaro/sypex-geoip "@dev"
or add
"kwazaro/sypex-geoip": "@dev"
to the require section of your composer.json
file.
Once the library is installed, simply use it in your code by :
<?php
use kwazaro\sypexgeoip\Geoip;
$geo = new Geoip();
$data = $geo->get('xxx.xxx.xxx.xxx');
$country = $geo->getCountry('xxx.xxx.xxx.xxx');
$vity = $geo->getCity('xxx.xxx.xxx.xxx');
$fullInfo = $geo->getCityFull('xxx.xxx.xxx.xxx');