承接 leroy-merlin-br/geo 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

leroy-merlin-br/geo

最新稳定版本:1.0-beta

Composer 安装命令:

composer require leroy-merlin-br/geo

包简介

Geolocation utilities

README 文档

README

leroy-merlin-br/geo is a simple to use set of tools for geolocation. It's an abstraction built on top of the powerfull phayes/geophp.

SensioLabsInsight

Region matching

With the LeroyMerlin\GeoTools\RegionMatcher you can easily test if a coordinate is inside of a region.

Example of use:

$regionMatcher = new LeroyMerlin\GeoTools\RegionMatcher;

$regionMatcher->loadRegion('/path/to/myRegion.kml');
$regionMatcher->loadRegion('/path/to/intersectingRegion.kml');
$regionMatcher->loadRegion('/path/to/farAwayRegion.kml');

$regionMatcher->getRegionsThatMatches(23, 23);
// returns ['myRegion', 'intersectingRegion']

IP to geolocation

LeroyMerlin\GeoTools\IpLocator uses ip-api.com to find out the geolocation of a given IP address.

Example of use:

$locator = new LeroyMerlin\GeoTools\IpLocator;

$locator->getLocation('208.80.152.201');
// array(
//   'as' => 'AS14907 Wikimedia Foundation Inc.',
//   'city' => 'San Francisco',
//   'country' => 'United States',
//   'countryCode' => 'US',
//   'isp' => 'Wikimedia Foundation',
//   'lat' => 37.7898,
//   'lon' => -122.3942,
//   'org' => 'Wikimedia Foundation',
//   'query' => '208.80.152.201',
//   'region' => 'CA',
//   'regionName' => 'California',
//   'status' => 'success',
//   'timezone' => 'America/Los_Angeles',
//   'zip' => '94105'
// )

$locator->getCoordinates('208.80.152.201');
// array(
//   'x' => 37.7898,
//   'y' => -122.3942
// )

统计信息

  • 总下载量: 4.43k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 12
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 11
  • Watchers: 16
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-04-02