PHP Address Geocoding for laravel using Google API
composer require sapioweb/geocode
Include Sapioweb\Geocode\GeocodeServiceProvider::class,
in your config/app.php
use Sapioweb\Geocode\GeoCode;
Route::get('/', function () {
$geocode = new Geocode;
$address = '1600 Wigwam Pkwy, Henderson, NV 89074';
$geocode = $geocode->getCoordinates($address);
return view('welcome')->with(['geocode' => $geocode]);
});
Pull Latitude: $geocode['geometry']['location']['lat']
Pull Longitude: $geocode['geometry']['location']['lng']
This software is open-sourced software licensed under the MIT license. For questions please email [email protected] or [email protected] or visit Sapioweb.com to learn more and get in contact