PHPackages                             hanyfreestyle/filament-locationpickr-field - 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. hanyfreestyle/filament-locationpickr-field

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

hanyfreestyle/filament-locationpickr-field
==========================================

Location picker field for Filament Php using Google Maps

v1.0.0(1y ago)057MITJavaScriptPHP ^8.1

Since Apr 13Pushed 1y ago1 watchersCompare

[ Source](https://github.com/hanyfreestyle/dev-filament-locationpickr-field)[ Packagist](https://packagist.org/packages/hanyfreestyle/filament-locationpickr-field)[ Docs](https://github.com/arbermustafa/filament-locationpickr-field)[ RSS](/packages/hanyfreestyle-filament-locationpickr-field/feed)WikiDiscussions master Synced 1mo ago

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

Filament LocationPickr Field
============================

[](#filament-locationpickr-field)

This package provides just a simplified location picker field within [Filament](https://filamentphp.com) using Google Maps based on the excellent work of [Hugh Messenger](https://filamentphp.com/plugins/cheesegrits-google-maps).

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

[](#installation)

You can install the package into a Laravel app that uses [Filament](https://filamentphp.com) via composer::

```
composer require arbermustafa/filament-locationpickr-field:"^2.0.0"
```

**Filament V2** - if you are using Filament v2.x, you can use [1.x](https://github.com/arbermustafa/filament-locationpickr-field/tree/1.x) branch.

You can publish the config file with:

```
php artisan vendor:publish --tag=filament-locationpickr-field-config
```

The `config` file contains default global customization options for map rendering, like: api key, default location, etc.

Optionally, you can publish the view using:

```
php artisan vendor:publish --tag=filament-locationpickr-field-views
```

Setting your Google Maps API Key
--------------------------------

[](#setting-your-google-maps-api-key)

All use of the Google Maps API requires an API key. If you don't have one, refer to [Google's documentation](https://developers.google.com/maps/documentation/javascript/get-api-key).

Once you have a key, either add it to your .env file as:

```
GMAP_API=your_map_api_key_here

```

... or publish and edit the `filament-locationpickr-field.php` config file.

Preparing the models
--------------------

[](#preparing-the-models)

Add a `location` column to any model migration schema used for map data

```
...

Schema::table('table_name', function (Blueprint $table) {
    $table->json('location')->nullable();
});

...
```

and add the column to the model fillable array

```
...

protected $fillable = [
    ...
    'location',
];
```

If you have separate columns for `lat` and `lng` you can use a computed property on any model being used for map data and use a mutator which converts between separate lat and lng fields on your table, and a Google Point style array of 'lat' and 'lng' keys.

```
...

protected $appends = [
    ...
    'location',
];

...

public function location(): Attribute
{
    return Attribute::make(
        get: fn ($value, $attributes) => json_encode([
            'lat' => (float) $attributes['lat'],
            'lng' => (float) $attributes['lng'],
        ]),
        set: fn ($value) => [
            'lat' => $value['lat'],
            'lng' => $value['lng'],
        ],
    );
}

...
```

Usage
-----

[](#usage)

### Form field

[](#form-field)

The form field can be used with no options, by simply adding this to your Filament Form schema:

```
use ArberMustafa\FilamentLocationPickrField\Forms\Components\LocationPickr;
...

    ->schema([
        ...
        LocationPickr::make('location'),
        ....
    ]);
...
```

The name used in the `make()` function must be the one you set up as your model's column/computed location property.

### Full options

[](#full-options)

The full set of options is as follows. All option methods support closures, as well as direct values.

```
use ArberMustafa\FilamentLocationPickrField\Forms\Components\LocationPickr;
...

    ->schema([
        ...
        LocationPickr::make('location')
            ->mapControls([
                'mapTypeControl'    => true,
                'scaleControl'      => true,
                'streetViewControl' => true,
                'rotateControl'     => true,
                'fullscreenControl' => true,
                'zoomControl'       => false,
            ])
            ->defaultZoom(5)
            ->draggable()
            ->clickable()
            ->height('40vh')
            ->defaultLocation([41.32836109345274, 19.818383186960773])
            ->myLocationButtonLabel('My location'),
        ....
    ]);
...
```

### Infolist entry

[](#infolist-entry)

The infolist entry can be used with no options, by simply adding this to your Filament Infolist schema:

```
use ArberMustafa\FilamentLocationPickrField\Infolists\Components\LocationPickr;
...

    ->schema([
        ...
        LocationPickr::make('location'),
        ....
    ]);
...
```

The name used in the `make()` function must be the one you set up as your model's column/computed location property. The components accepts options like `defaultZoom`, `defaultLocation` and `height`.

#### Example usage in simple resource

[](#example-usage-in-simple-resource)

[![Locationpickr field in modal](./docs/images/locationpickr.png)](./docs/images/locationpickr.png)

Changelog
---------

[](#changelog)

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

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

[](#contributing)

If you want to contribute to this package, you may want to test it in a real Filament project:

- Fork this repository to your Github account.
- Create a Filament app locally.
- Clone your fork in your Filament app root directoy.
- In the `/filament-locationpickr-field` directory, create a branch for your fix/improvement, e.g. `fix/pickr-field`.

Install the package in your app's `composer.json`:

```
"require": {
    "arbermustafa/filament-locationpickr-field": "dev-fix/pickr-field as dev-main",
},
"repositories": [
    {
        "type": "path",
        "url": "./filament-locationpickr-field"
    }
]
```

Now run `composer update`.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Arber Mustafa](https://github.com/arbermustafa)
- [Hugh Messenger](https://github.com/cheesegrits)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance47

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

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

395d ago

### Community

Maintainers

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

---

Top Contributors

[![hanyfreestyle](https://avatars.githubusercontent.com/u/81318840?v=4)](https://github.com/hanyfreestyle "hanyfreestyle (5 commits)")

---

Tags

phplaravelmapsformfieldgoogle mapsfilament-pluginarbermustafafilament-locationpickr-field

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/hanyfreestyle-filament-locationpickr-field/health.svg)

```
[![Health](https://phpackages.com/badges/hanyfreestyle-filament-locationpickr-field/health.svg)](https://phpackages.com/packages/hanyfreestyle-filament-locationpickr-field)
```

###  Alternatives

[arbermustafa/filament-locationpickr-field

Location picker field for Filament Php using Google Maps

1539.0k](/packages/arbermustafa-filament-locationpickr-field)[bezhansalleh/filament-google-analytics

Google Analytics integration for FilamentPHP

205144.8k5](/packages/bezhansalleh-filament-google-analytics)[schmeits/filament-character-counter

This is a Filament character counter TextField and Textarea form field for Filament v4 and v5

33184.7k6](/packages/schmeits-filament-character-counter)[arbermustafa/filament-google-charts-widgets

Chart widgets for Filament Php using Google Charts

147.4k](/packages/arbermustafa-filament-google-charts-widgets)[tapp/filament-google-autocomplete-field

Filament plugin that provides a Google Autocomplete field

3098.1k](/packages/tapp-filament-google-autocomplete-field)[jiten14/jitone-ai

jitone-ai is a powerful FilamentPHP plugin that integrates AI-powered features directly into your Filament forms.

213.1k](/packages/jiten14-jitone-ai)

PHPackages © 2026

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