Replaced by Google Maps PHP SDK
Simple Google Maps Geocoder PHP library. Get Latitude and Longitude of selected address in few steps!
You can install the package via composer:
composer require biscolab/geocoder:^1.0
- Chose the address
$address = 'street <YOUR_STREET>, <YOUR_CITY>, <YOUR_COUNTRY>';
- Get location
$loc = (new Geocoder($address))->getLocation();
- Use data
getLocation
method returns aGeocoderLocation
object. To retrieve latitude (Lat) and longitude (Lng) use the following methods:
/**
* Return the latitude
*
* @return float
*/
$lat = $loc->getLat();
/**
* Return the longitude
*
* @return float
*/
$lng = $loc->getLng();
That's it!