2017 © Pedro Peláez
 

library ip

通过ip返回中文地理位置

image

draguo/ip

通过ip返回中文地理位置

  • Monday, March 5, 2018
  • by draguo
  • Repository
  • 1 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 4 Versions
  • 14 % Grown

The README.md

通过ip获取中文地理位置

Build Status , (*1)

说明

依赖于各家提供的 api, (*2)

使用

$config = [
    'driver' => 'amap'
    'key' => 'qweqweqwassdf',
];

// return array
$service = new Ip($config);
$location = $service->toLocation($ip); 
[
    country
    province
    city
    adcode // 城市的编号
    lng // 经度
    lat // 维度
    isp // 服务商
]

为了方便使用, toLocation 返回的方法进行了重新包装,但由于各家服务商提供的数据 不一致,所以部分数据会不存在,如果需要原样的数据可以调用,toLocationRaw($ip)
driver 名见下面的支持计划中黑体字部分, (*3)

已经支持计划(免费使用的) 淘宝 taobao 高德地图 amap 百度地图 baidu, (*4)

未来支持(没有提供免费试用 api) - [ ] ipip.net api - [ ] ipip.net 数据库 - [ ] 纯真数据库 - [ ] ip 问问 api - [ ] ip 问问 数据库, (*5)

The Versions

05/03 2018

dev-master

9999999-dev

通过ip返回中文地理位置

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar draguo

01/03 2018

dev-dev

dev-dev

通过ip返回中文地理位置

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar draguo

18/01 2018

2.0

2.0.0.0

通过ip返回中文地理位置

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar draguo

08/03 2017

1.0

1.0.0.0

通过ip返回中文地理位置

  Sources   Download

MIT

by Avatar draguo