gabrielfs7/google-location

使用谷歌网络服务获取位置

0.0.1 2015-05-05 12:45 UTC

This package is auto-updated.

Last update: 2024-09-27 01:00:25 UTC


README

使用PHP从谷歌获取位置数据

<?php
$coordinates = (new \GSoares\Google\Location\CoordinatesLocator())
    ->setStreet('Marechal Rondon')
    ->setNumber('998')
    ->setDistrict('Barreiros')
    ->setCity('Sao Jose')
    ->setState('Santa Catarina')
    ->setPostcode('88117030')
    ->setCountry('Brasil')
    ->locate();
    
//OR using single parameters...

$coordinates = (new \GSoares\Google\Location\CoordinatesLocator())
    ->setPostcode('88117030')
    ->locate();
    
/* 
RETURNS:

object(GSoares\Google\Location\Address\Coordinates)#6 (2) {
  ["latitude"]=>
  string(11) "-27.5818202"
  ["longitude"]=>
  string(11) "-48.6039563"
}
*/
?>

需求

  • PHP 5.4+

安装(composer)