2017 © Pedro Peláez
 

library geoservice

Geolocation module using multiple free geo services

image

kubrey/geoservice

Geolocation module using multiple free geo services

  • Wednesday, November 22, 2017
  • by kubrey
  • Repository
  • 1 Watchers
  • 0 Stars
  • 60 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 10 Versions
  • 7 % Grown

The README.md

Geo data detection by IP

Searching geo data by IP address

Description

Include several services:, (*1)

  • Maxmind
  • Ipgeobase.ru
  • Ipinfo.io
  • Freegeoip.net
  • Geobytes.com
  • Telize.com
  • Maxmind Legacy(v1)
  • IpApi(ip-api.com)

Installation

Composer., (*2)

Add kubrey/geoservice to your composer.json, (*3)

OR, (*4)

composer require kubrey/geoservice

If you have no composer, install beforehand:, (*5)

Run in the project's root:, (*6)

curl -s http://getcomposer.org/installer | php

And then :, (*7)

php composer.phar init

Usage

require 'vendor/autoload.php';

use GeoServices\GeoService;
use GeoServices\GeoException;

$g = new GeoService();
try {
    //set maxmind v2  absolute path to mmdb file(if you want to use this method)
    $g->setMaxmindDb(dirname(__FILE__) . '/GeoLite2-City.mmdb');
    //set maxmind-legacy  absolute path to dat file(if you want to use this method)
    $g->setMaxmindOldDb(dirname(__FILE__).'/GeoLiteCity.dat');
    $data = $g->lookup('95.153.74.242');
    var_dump($data->city);
} catch (GeoException $ex) {
    echo $ex->getMessage();
}

$data is an instance of GeoObject, containing these properties:, (*8)

  • countryName
  • city
  • latitude
  • longitude
  • zip
  • regionName
  • countryCode
  • isp

To set your own method priority:, (*9)

$g->maxmind = 1;//run first
$g->ipgeobaseru = false;//do not use
$g->ipinfo = 3;

To set required geo parameters, (*10)

$g->isCityRequired = false; - поиск города не обязателен

To set timeout in milliseconds:, (*11)

$g->setGlobalTimeout(5000);

To set timeout for each online service in milliseconds:, (*12)

$g->setRequestTimeout(1000);

Tests

PHPUnit:, (*13)

/usr/bin/php vendor/phpunit/phpunit/phpunit --colors --bootstrap vendor/autoload.php tests

The Versions

22/11 2017

dev-master

9999999-dev

Geolocation module using multiple free geo services

  Sources   Download

MIT

The Requires

 

The Development Requires

by Sergey Kubrey

geoip geolocation ipgeobase ipgeobase.ru ip service free geo location

22/11 2017

2.0.1

2.0.1.0

Geolocation module using multiple free geo services

  Sources   Download

MIT

The Requires

 

The Development Requires

by Sergey Kubrey

geoip geolocation ipgeobase ipgeobase.ru ip service free geo location

02/08 2016

1.8.0

1.8.0.0

Geolocation module using multiple free geo services

  Sources   Download

MIT

The Requires

 

The Development Requires

by Sergey Kubrey

geoip geolocation ipgeobase ipgeobase.ru ip service free geo location

02/08 2016

1.7.1

1.7.1.0

Geolocation module using multiple free geo services

  Sources   Download

MIT

The Requires

 

The Development Requires

by Sergey Kubrey

geoip geolocation ipgeobase ipgeobase.ru ip service free geo location

01/06 2016

1.7.0

1.7.0.0

Geolocation module using multiple free geo services

  Sources   Download

MIT

The Requires

 

The Development Requires

by Sergey Kubrey

geoip geolocation ipgeobase ipgeobase.ru ip service free geo location

26/05 2016

1.6.5

1.6.5.0

Geolocation module using multiple free geo services

  Sources   Download

MIT

The Requires

 

The Development Requires

by Sergey Kubrey

geoip geolocation ipgeobase ipgeobase.ru ip service free geo location

26/05 2016

1.6.4

1.6.4.0

Geolocation module using multiple free geo services

  Sources   Download

MIT

The Requires

 

The Development Requires

by Sergey Kubrey

geoip geolocation ipgeobase ipgeobase.ru ip service free geo location

25/05 2016

1.6.3

1.6.3.0

Geolocation module using multiple free geo services

  Sources   Download

MIT

The Requires

 

The Development Requires

by Sergey Kubrey

geoip geolocation ipgeobase ipgeobase.ru ip service free geo location

25/05 2016

1.6.2

1.6.2.0

Geolocation module using multiple free geo services

  Sources   Download

MIT

The Requires

 

The Development Requires

by Sergey Kubrey

geoip geolocation ipgeobase ipgeobase.ru ip service free geo location

26/09 2014

dev-testing

dev-testing

Geoservice PHP API

  Sources   Download

The Requires

 

The Development Requires

by Sergey Kubrey

geoip geolocation ipgeobase ipgeobase.ru ip service