2017 © Pedro Peláez
 

library ipgeo

Find geo location of ip

image

looking4soul/ipgeo

Find geo location of ip

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

IpGeo

Find geo location of ip., (*1)

Usage

Install

composer install

Set Up Redis

start up redis on 127.0.0.1:6379, (*2)

Download GeoLite2

http://dev.maxmind.com/geoip/geoip2/geolite2/, (*3)

Import Ip Geo Into Redis

<?php
require 'vendor/autoload.php';
$block = 'path/to/GeoLite2-City-Blocks-IPv4.csv';
$location = 'path/to/GeoLite2-City-Locations-zh-CN.csv';
$ipgeo = new \Looking4soul\IpGeo\IpGeo();
$ipgeo->import($block, $location);

Search City by Ip

<?php
require 'vendor/autoload.php';
$ipgeo = new \Looking4soul\IpGeo\IpGeo();
var_dump($ipgeo->find_city_by_ip('140.237.24.176'));
/*expected output is array of city and country in zh-CN.
array(2) {
  [0]=>
  string(0) ""
  [1]=>
  string(6) "中国"
}
*/

License

The MIT License (MIT)., (*4)

The Versions

25/11 2016

1.0.1

1.0.1.0 https://github.com/looking4soul/ipgeo

Find geo location of ip

  Sources   Download

MIT

The Requires

 

The Development Requires

geo ip

25/11 2016

dev-master

9999999-dev https://github.com/looking4soul/ipgeo

Find geo location of ip

  Sources   Download

MIT

The Requires

 

The Development Requires

geo ip

25/11 2016

1.0.0

1.0.0.0 https://github.com/looking4soul/ipgeo

Find geo location of ip

  Sources   Download

MIT

The Requires

 

The Development Requires

geo ip