PHPackages                             hnooz/nova-google-map-autocomplete - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. hnooz/nova-google-map-autocomplete

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

hnooz/nova-google-map-autocomplete
==================================

A Laravel Nova Google autocomplete field.

1.0.0(1y ago)38.5k↓47.2%4MITVuePHP ^8.0CI passing

Since Apr 17Pushed 1y ago1 watchersCompare

[ Source](https://github.com/hnooz/nova-google-map-autocomplete)[ Packagist](https://packagist.org/packages/hnooz/nova-google-map-autocomplete)[ Docs](https://github.com/hnooz/nova-google-autocomplete)[ RSS](/packages/hnooz-nova-google-map-autocomplete/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

Nova Google AutoComplete Field Package
======================================

[](#nova-google-autocomplete-field-package)

[![Latest Version](https://camo.githubusercontent.com/da6f755ecaa90a7ef7d33ef409227920d8182f6caf318ec685ac34092e40a52b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f686e6f6f7a2f6e6f76612d676f6f676c652d6d61702d6175746f636f6d706c6574653f7374796c653d666c61742d737175617265)](https://github.com/hnooz/nova-google-map-autocomplete/releases)

This field allows you to work with Google Places API to autocomplete on user input and get the full real address with all the metadata (like latitude and longitude).

Fork from [yieldstudio/nova-google-autocomplete-field](https://github.com/yieldstudio/nova-google-autocomplete) to maintain package.

Installation
------------

[](#installation)

You can install the package in to a Laravel app that uses Nova via composer:

```
composer require hnooz/nova-google-map-autocomplete
```

Now publish config and localization files:

```
php artisan vendor:publish --provider="Hnooz\NovaGoogleAutocomplete\FieldServiceProvider"
```

Create an app and enable Places API and create credentials to get your API key

Add the below to your `.env` file

```
NOVA_GOOGLE_AUTOCOMPLETE_API_KEY=############################
```

Usage
-----

[](#usage)

Add the use declaration to your resource and use the fields:

```
use Hnooz\NovaGoogleAutocomplete\GoogleAutocomplete;
// ....

GoogleAutocomplete::make('Address'),

//You can add a country or countries to autocomplete or leave empty for all.

// Specify a single country
GoogleAutocomplete::make('Address')
          ->countries('US'),

// Specify multiple countries [array]
GoogleAutocomplete::make('Address')
          ->countries(['US','AU']),
```

You can access other parameter like `latitude, longitude, street_number, route, locality, administrative_area_level_1, country, postal_code`, along with everything available in the - every field present in the [PlaceResult object](https://developers.google.com/maps/documentation/javascript/reference/#PlaceResult)

```
use Hnooz\NovaGoogleAutocomplete\AddressMetadata;
use Hnooz\NovaGoogleAutocomplete\GoogleAutocomplete;

// Now this address field will search and store the address as a string, but also made available the values in the withValues array
GoogleAutocomplete::make('Address')->withValues(['latitude', 'longitude']),

// And you can store the values by autocomplete like this
AddressMetadata::make('lat')->fromValue('latitude'),
AddressMetadata::make('long')->fromValue('longitude'),

// You can disable the field so the user can't edit the metadata
AddressMetadata::make('long')->fromValue('longitude')->disabled(),

// Or you can make the field invisible in the form but collect the data anyways
AddressMetadata::make('long')->fromValue('longitude')->invisible(),
```

By default, the formatted address will be stored on the property provided in the GoogleAutocomplete field. If you don't want to store it, you can use the `dontStore` method:

```
use Hnooz\NovaGoogleAutocomplete\AddressMetadata;
use Hnooz\NovaGoogleAutocomplete\GoogleAutocomplete;

// Formatted address will not be stored
GoogleAutocomplete::make('Address')->withValues(['latitude', 'longitude'])->dontStore(),

// This field will be stored
AddressMetadata::make('lat')->fromValue('latitude'),
AddressMetadata::make('long')->fromValue('longitude'),
```

### Combine Values

[](#combine-values)

If you want to concatenate certain elements of the geocoded object that is returned by Google, using `{{` and `}}`, wrap the key like you would above; like so:

```
use Hnooz\NovaGoogleAutocomplete\AddressMetadata;
use Hnooz\NovaGoogleAutocomplete\GoogleAutocomplete;

GoogleAutocomplete::make('Address')->withValues(['latitude', 'longitude']),

AddressMetadata::make('coordinates')->fromValue('{{latitude}}, {{longitude}}'),
```

So the value that would be rendered within the coordinates input would be something like:

```
39.3315476, -94.9363912

```

### Define Short/Long Value

[](#define-shortlong-value)

If you would like to use the **long\_name** version of the geocoded object (Kansas versus KS), you can define the `GoogleAutocomplete` field values with dot notation followed with the name version you want to use; like so:

```
use Hnooz\NovaGoogleAutocomplete\GoogleAutocomplete;

GoogleAutocomplete::make('Address')
    ->withValues([
        'route.short_name',
        'administrative_area_level_1.long_name',
    ]),
```

Which would return:

**route:** W 143rd St

**administrative\_area\_level\_1:** Kansas

You can change the type of places that are returned by the autocomplete using the placeType() method. You can use any of the values listed at [https://developers.google.com/places/supported\_types#table3](https://developers.google.com/places/supported_types#table3)

```
use Hnooz\NovaGoogleAutocomplete\AddressMetadata;
use Hnooz\NovaGoogleAutocomplete\GoogleAutocomplete;

// This autocomplete field will return results that match a business name instead of address.
// All the same address data is still stored.
GoogleAutocomplete::make('Address')->placeType('establishment');
```

### Capturing all values as JSON

[](#capturing-all-values-as-json)

If you want to capture all requested values as a JSON object, you can use the `fromValuesAsJson()` helper instead of using `fromValue()`.

```
// Autocomplete field
GoogleAutocomplete::make('Location')
    ->countries('BE')
    ->withValues(['latitude', 'longitude', 'street_number', 'route', 'locality', 'administrative_area_level_1', 'country', 'postal_code']),

// Field that will capture de response object
AddressMetadata::make('Address')
    ->fromValuesAsJson()
    ->invisible()
    ->onlyOnForms(),

// Display the response object in a Code field
Code::make('Address')->json()->onlyOnDetail(),
```

Localization
------------

[](#localization)

If you want this package in your language, just create a json lang file in your `resources/lang/vendor/nova-google-autocomplete` folder.

Credits
-------

[](#credits)

- [James Hemery](https://github.com/jameshemery) - Original developer
- [Mohamed Idris](https://github.com/hnooz) - Fork maintainer

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance44

Moderate activity, may be stable

Popularity32

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

442d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5015db7c565fa0cd3839061cf59e75dbf9331cc9a4ac92ee0f52fe7955917400?d=identicon)[Hnooz](/maintainers/Hnooz)

---

Top Contributors

[![hnooz](https://avatars.githubusercontent.com/u/44949769?v=4)](https://github.com/hnooz "hnooz (10 commits)")[![jamesil](https://avatars.githubusercontent.com/u/7086382?v=4)](https://github.com/jamesil "jamesil (1 commits)")

---

Tags

google-maps-apigoogle-place-autocompletelaravelautocompleteaddressgooglenovahnooz

###  Code Quality

Static AnalysisRector

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/hnooz-nova-google-map-autocomplete/health.svg)

```
[![Health](https://phpackages.com/badges/hnooz-nova-google-map-autocomplete/health.svg)](https://phpackages.com/packages/hnooz-nova-google-map-autocomplete)
```

###  Alternatives

[optimistdigital/nova-sortable

This Laravel Nova package allows you to reorder models in a Nova resource's index view using drag &amp; drop.

2852.1M6](/packages/optimistdigital-nova-sortable)[outl1ne/nova-sortable

This Laravel Nova package allows you to reorder models in a Nova resource's index view using drag &amp; drop.

2862.1M9](/packages/outl1ne-nova-sortable)[yieldstudio/nova-google-autocomplete

A Laravel Nova Google autocomplete field.

12239.3k](/packages/yieldstudio-nova-google-autocomplete)[markwalet/nova-modal-response

A Laravel Nova asset for Modal responses on an action.

17878.9k](/packages/markwalet-nova-modal-response)[advoor/nova-editor-js

A Laravel Nova field bringing EditorJs magic to Nova.

92219.3k3](/packages/advoor-nova-editor-js)[outl1ne/nova-page-manager

Page(s) and region(s) manager for Laravel Nova.

17947.0k](/packages/outl1ne-nova-page-manager)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
