A class to handle Google geocoding.
- PHP >= 7.0.0
- Get the Google Maps Geocoding API key:
https://developers.google.com/maps/documentation/geocoding/get-api-key - Install this package in your project:
composer require geocoder/geocoder
- To geocode an address:
$result = (new Geocoder('THE_API_KEY'))->geocode('THE_ADDRESS');
- To get latitude and longitude:
(new Geocoder('THE_API_KEY'))->getLatLng('THE_ADDRESS')