jayin/ipgeo
Composer 安装命令:
composer require jayin/ipgeo
包简介
Get IP GEO
README 文档
README
获取IP的地理位置信息(所属国家、省、市、区、经纬度)
支持地图:
- 腾讯地图 https://lbs.qq.com
- TODO 百度地图
- TODO CZ88 https://www.cz88.net/help?id=free
Install
$ composer require jayin/ipgeo -vvv
Usage
$ipGeo = new IpGeo(); $ipGeo->setConfig([ 'driver' => 'Tencent', 'drivers' => [ 'Tencent' => [ [ 'app_key' => '{app_key}', ] ], ] ]); $ip = '61.140.183.172'; $info = $ipGeo->geo($ip); // 指定配置 $info = $ipGeo->useDriver('baidu')->geo($ip)
返回格式如下
{
"driver": "Tencent",
"ip": "61.140.183.172",
"lat": 23.12908,
"lng": 113.26436,
"nation": "中国",
"province": "广东省",
"city": "广州市",
"district": ""
}
Test
$ composer run test
License
MIT
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-06-07