flexydigital/google-location

Get location using google web services

1.0.0 2021-12-09 16:37 UTC

This package is auto-updated.

Last update: 2024-05-07 04:13:05 UTC


README

Retrieve location data from Google using 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"
}
*/
?>

Requirements

  • PHP 5.4+

Install (composer)