定制 popphp/pop-geo 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

popphp/pop-geo

最新稳定版本:2.1.0p1

Composer 安装命令:

composer require popphp/pop-geo

包简介

Pop Geo Component for Pop PHP Framework

README 文档

README

Build Status Coverage Status

END OF LIFE

The pop-geo component v2.1.0 is now end-of-life and will no longer be supported due to lack of support for the GeoIP extension in PHP 7.

OVERVIEW

pop-geo is a component for leveraging the GeoIP databases and calculating information about IP location as well as distances between sets of longitude and latitude points.

pop-geo is a component of the Pop PHP Framework.

INSTALL

Install pop-geo using Composer.

composer require popphp/pop-geo

BASIC USAGE

If the GeoIP extension and databases are installed, it will autodetect information based on the IP.

use Pop\Geo\Geo;

$nola = new Geo();

echo $nola->getLatitude();  // 29.9546500
echo $nola->getLongitude(); // -90.0750700
Calculate the distance between to sets of points

You can give it a second set of coordinates to calculate the distance between them:

$houston = new Geo([
    'latitude'  => 29.7632800,
    'longitude' => -95.3632700
]);

echo $nola->distanceTo($houston);          // Outputs '317.11' miles
echo $nola->distanceTo($houston, 2, true); // Outputs '510.34' kilometers

You can also manually give it 2 sets of points as well:

use Pop\Geo\Geo;

$nola = [
    'latitude'  => 29.9546500,
    'longitude' => -90.0750700
];

$houston = [
    'latitude'  => 29.7632800,
    'longitude' => -95.3632700
];

echo Geo::calculateDistance($nola, $houston); // Outputs '317.11' miles

统计信息

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

GitHub 信息

  • Stars: 3
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: New
  • 更新时间: 2014-12-08