looking4soul/ipgeo
Composer 安装命令:
composer require looking4soul/ipgeo
包简介
Find geo location of ip
README 文档
README
#IpGeo
Find geo location of ip.
##Usage
###Install
composer install
###Set Up Redis
start up redis on 127.0.0.1:6379
###Download GeoLite2
http://dev.maxmind.com/geoip/geoip2/geolite2/
###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).
统计信息
- 总下载量: 13
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-11-25