danielsonsilva / findme
帮助您在这个世界上找到任何东西的软件包,以及其他与GPS相关的方法
v1.0.0
2020-06-04 19:50 UTC
Requires
- mjaschen/phpgeo: ^3.0
Requires (Dev)
- phpunit/phpunit: ^9.1
- squizlabs/php_codesniffer: ^3.5
This package is auto-updated.
Last update: 2024-09-05 07:47:28 UTC
README
帮助您在这个世界上找到自己,以及其他一些与GPS相关的辅助方法
此库使用来自https://ipstack.com/的服务
如何使用
// create your object using your API Key from IpStack
$findMeObject = new FindMe('DUuhew712hnhNNASbdnw90');
// Get the IP string from your cliente and set the information
$findMeObject->setInformationFromIp($ip);
// Now that you have your object loaded, you can use methods like
echo $findMeObject->getCountryName();
// Or you can define new latitudes and longitudes
$destinyLatitude = -15.90377472;
$destinyLongitude = 9.673627181;
// And get the distance though three different ways
echo $findMeObject->getDistanceTo($destinyLatitude, $destinyLongitude); //in kilometers
echo $findMeObject->getDistanceToVicenty($destinyLatitude, $destinyLongitude); //in meters
echo $findMeObject->getDistanceToHaversine($destinyLatitude, $destinyLongitude); //in meters