Laravel 9 Google Autocomplete Address

In this article, we will see the laravel 9 google autocomplete address. Here, we will learn how to google autocomplete addresses in laravel 9. You can find out how to create and implement a google autocomplete address in laravel 9 with the use of google address API.

Autocomplete is a feature of the place library in the Maps javascript API. You can use autocomplete to give your applications the type-ahead-search behavior of the google maps search field.

Laravel google autocomplete address helps you display the complete address such as longitude, latitude, country, state, city, and zip code.

So, let's see laravel 9 google maps autocomplete, laravel 9 google place API, laravel 9 place autocomplete, google autocomplete city, and google autocomplete country.

Step 1: Install Laravel 9 Application

Step 2: Google Place API Key

Step 3: Create a Route

Step 4: Create Controller

Step 5: Create Blade View File


Step 1: Install Laravel 9 Application for Google Autocomplete Address

In this step, we will install the laravel 9 application using the following command.

composer create-project --prefer-dist laravel/laravel laravel-9-google-autocomplete-address



Step 2: Google Place API Key

Now, we need Google Place API Key. So, visit and get the place google API key. The Places API is a service that returns information about places using HTTP requests. Places are defined within this API as establishments, geographic locations, or prominent points of interest.


Step 3: Create a Route

In this step, we will create a route to the web.php file.


use Illuminate\Support\Facades\Route;
use App\Http\Controllers\GoogleAddressController;
Route::get('google-autocomplete-address', [GoogleAddressController::class, 'index']);


Step 4: Create Controller

In this step, we will create a GoogleAddressController file. So, add the following code to that file.


namespace App\Http\Controllers;
use Illuminate\Http\Request;
class GoogleAddressController extends Controller
    public function index()
        return view('google_autocomplete_address');



Step 5: Create Blade View File

Now, we will create blade files for viewing. So, add the following code to that file.


<!DOCTYPE html>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Laravel 9 Google Autocomplete Address - Techsolutionstuff</title>
    <link rel="stylesheet" href="">
    <script src=""></script>
    <div class="container mt-5">
        <h2>Laravel 9 Google Autocomplete Address - Techsolutionstuff</h2><br>  
        <div class="form-group">            
            <input type="text" name="autocomplete" id="autocomplete" class="form-control" placeholder="Enter Location">
        <div class="form-group" id="latitudeArea">
            <input type="text" id="latitude" name="latitude" class="form-control">
        <div class="form-group" id="longtitudeArea">
            <input type="text" name="longitude" id="longitude" class="form-control">
        <button type="submit" class="btn btn-primary">Submit</button>
    <script src=""></script>
    <script src=""></script>  
    <script type="text/javascript" src="" ></script>
        $(document).ready(function () {
        google.maps.event.addDomListener(window, 'load', initialize);
        function initialize() {
            var input = document.getElementById('autocomplete');
            var autocomplete = new google.maps.places.Autocomplete(input);
            autocomplete.addListener('place_changed', function () {
                var place = autocomplete.getPlace();



For testing purposes, you can use the below script.

<script type="text/javascript" src=""></script>

Copy the below URL and run it on the browser.



You might also like:


Techsolutionstuff | The Complete Guide

I'm a software engineer and the founder of Hailing from India, I craft articles, tutorials, tricks, and tips to aid developers. Explore Laravel, PHP, MySQL, jQuery, Bootstrap, Node.js, Vue.js, and AngularJS in our tech stack.