PHPackages                             yieldstudio/nova-google-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. yieldstudio/nova-google-autocomplete

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

yieldstudio/nova-google-autocomplete
====================================

A Laravel Nova Google autocomplete field.

1.3.0(2y ago)12239.3k↓20.4%18[5 issues](https://github.com/YieldStudio/nova-google-autocomplete/issues)[4 PRs](https://github.com/YieldStudio/nova-google-autocomplete/pulls)MITVuePHP ^8.0

Since Jun 1Pushed 1y ago2 watchersCompare

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

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

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

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

[![Latest Version](https://camo.githubusercontent.com/9602cc1013c56ce77148e31120e7b40bd2d5f7e171740d60688d44acdcad7b49/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f7969656c6473747564696f2f6e6f76612d676f6f676c652d6175746f636f6d706c6574653f7374796c653d666c61742d737175617265)](https://github.com/yieldstudio/nova-google-autocomplete/releases)[![Total Downloads](https://camo.githubusercontent.com/114adbd27525def5c7de8ed56cbe0e208a7cb021ca8de52e55b9b44c735e0974/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7969656c6473747564696f2f6e6f76612d676f6f676c652d6175746f636f6d706c6574653f7374796c653d666c61742d737175617265)](https://packagist.org/packages/yieldstudio/nova-google-autocomplete)

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 [emilianotisato/nova-google-autocomplete-field](https://github.com/emilianotisato/nova-google-autocomplete-field) to maintain package.

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

[](#installation)

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

```
composer require yieldstudio/nova-google-autocomplete
```

Now publish config and localization files:

```
php artisan vendor:publish --provider="YieldStudio\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 YieldStudio\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 YieldStudio\NovaGoogleAutocomplete\AddressMetadata;
use YieldStudio\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 YieldStudio\NovaGoogleAutocomplete\AddressMetadata;
use YieldStudio\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 YieldStudio\NovaGoogleAutocomplete\AddressMetadata;
use YieldStudio\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 YieldStudio\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 YieldStudio\NovaGoogleAutocomplete\AddressMetadata;
use YieldStudio\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.

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you've found a bug regarding security please mail  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Emiliano Tisato](https://github.com/emilianotisato) - Original developer
- [James Hemery](https://github.com/jameshemery) - Fork maintainer
- [Simon Depelchin](https://github.com/depsimon) - Contributor

License
-------

[](#license)

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

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity45

Moderate usage in the ecosystem

Community16

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 72.5% 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

Every ~146 days

Total

4

Last Release

1053d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a985e513235f5995a359a9a714ef8b97a5aa36c6d58f00363ddcb69792f4e612?d=identicon)[JamesHemery](/maintainers/JamesHemery)

---

Top Contributors

[![JamesHemery](https://avatars.githubusercontent.com/u/23323941?v=4)](https://github.com/JamesHemery "JamesHemery (29 commits)")[![depsimon](https://avatars.githubusercontent.com/u/1822289?v=4)](https://github.com/depsimon "depsimon (9 commits)")[![beneverard](https://avatars.githubusercontent.com/u/84081?v=4)](https://github.com/beneverard "beneverard (2 commits)")

---

Tags

autocompletegooglelaravelnovalaravelautocompleteaddressgooglenovayieldstudio

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/yieldstudio-nova-google-autocomplete/health.svg)](https://phpackages.com/packages/yieldstudio-nova-google-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)[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)[sbine/route-viewer

A Laravel Nova tool to view your registered routes.

58249.9k](/packages/sbine-route-viewer)

PHPackages © 2026

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