PHPackages                             afsakar/filament-leaflet-map-picker - 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. afsakar/filament-leaflet-map-picker

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

afsakar/filament-leaflet-map-picker
===================================

A Filament Forms component that provides an interactive Leaflet map for selecting and storing geographical coordinates.

v2.0.0(7mo ago)387.2k↓25%6[1 issues](https://github.com/afsakar/filament-leaflet-map-picker/issues)[3 PRs](https://github.com/afsakar/filament-leaflet-map-picker/pulls)MITJavaScriptPHP ^8.2CI passing

Since Apr 22Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/afsakar/filament-leaflet-map-picker)[ Packagist](https://packagist.org/packages/afsakar/filament-leaflet-map-picker)[ Docs](https://github.com/afsakar/filament-leaflet-map-picker)[ GitHub Sponsors](https://github.com/afsakar)[ RSS](/packages/afsakar-filament-leaflet-map-picker/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (8)Dependencies (13)Versions (12)Used By (0)

FilamentPHP LeafletJS Map Picker
================================

[](#filamentphp-leafletjs-map-picker)

A Filament Forms component that provides an interactive Leaflet map for selecting and storing geographical coordinates.

[![Latest Version on Packagist](https://camo.githubusercontent.com/d5380a7b0c8ec6e8dc371a66a9add037377296385a53b29ac464a087986b439e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616673616b61722f66696c616d656e742d6c6561666c65742d6d61702d7069636b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/afsakar/filament-leaflet-map-picker)[![GitHub Tests Action Status](https://camo.githubusercontent.com/71fc1c2f9dffe0376fb7b635e1a4a1cfdac47e2bec0143d8363f0db7f2d68521/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f616673616b61722f66696c616d656e742d6c6561666c65742d6d61702d7069636b65722f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/afsakar/filament-leaflet-map-picker/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/bf3e8e7ba67ca60d6a3df2aeeaf89f561204824e9106eac9de2fdffe4f01aa81/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f616673616b61722f66696c616d656e742d6c6561666c65742d6d61702d7069636b65722f6669782d7068702d636f64652d7374796c696e672e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/afsakar/filament-leaflet-map-picker/actions?query=workflow%3A%22Fix+PHP+code+styling%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/b7e72c47c2f0f31e021084994f41094e7a7e1ba3f013f50540fcc3ee8eba0294/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616673616b61722f66696c616d656e742d6c6561666c65742d6d61702d7069636b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/afsakar/filament-leaflet-map-picker)

[![Banner](https://raw.githubusercontent.com/afsakar/filament-leaflet-map-picker/main/art/leaflet-js-banner.png "Banner")](https://raw.githubusercontent.com/afsakar/filament-leaflet-map-picker/main/art/leaflet-js-banner.png)

Features
--------

[](#features)

- Interactive map for location selection
- Customizable map height
- Default location configuration
- Adjustable zoom level
- Draggable and clickable markers
- "My Location" button for quick navigation to user's current position
- Support for different tile providers (OpenStreetMap by default)
- Custom tile layer support
- Custom marker configuration

[![Screenshot](https://raw.githubusercontent.com/afsakar/filament-leaflet-map-picker/main/art/sc-default.png "Default")](https://raw.githubusercontent.com/afsakar/filament-leaflet-map-picker/main/art/sc-default.png)

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

[](#installation)

You can install the package via composer:

```
composer require afsakar/filament-leaflet-map-picker

php artisan vendor:publish --tag="filament-leaflet-map-picker-assets"
```

### Database Migration

[](#database-migration)

Create a column in your table to store the location data. You can use a `text` or `json` column type:

```
Schema::create('properties', function (Blueprint $table) {
    $table->id();
    // Other columns
    $table->text('location')->nullable(); // Stores coordinates as JSON string
    // OR
    $table->json('location')->nullable(); // Alternative approach
    $table->timestamps();
});
```

### Preparing the models

[](#preparing-the-models)

To use the LeafletMapPicker component, you need to prepare your database and model to store geographical coordinates. The component stores location data as a JSON string in the format `[lat, lng]`.

```
namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Property extends Model
{
    protected $fillable = [
        // Other fillable fields
        'location',
    ];

    protected $casts = [
        'location' => 'array',
    ];
}
```

You can publish the lang files with:

```
php artisan vendor:publish --tag="filament-leaflet-map-picker-translations"
```

Optionally, you can publish the views using

```
php artisan vendor:publish --tag="filament-leaflet-map-picker-views"
```

Usage
-----

[](#usage)

### Form

[](#form)

```
use Afsakar\LeafletMapPicker\LeafletMapPicker;

// Basic usage
LeafletMapPicker::make('location')
    ->label('Select Location')

// Advanced usage with customization
LeafletMapPicker::make('location')
    ->label('Property Location')
    ->height('500px')
    ->defaultLocation([41.0082, 28.9784]) // Istanbul coordinates
    ->defaultZoom(15)
    ->draggable() // default true
    ->clickable() // default true
    ->myLocationButtonLabel('Go to My Location')
    ->hideTileControl()
    ->readOnly() // default false, when you set this to true, the marker will not be draggable or clickable and current location and search location buttons will be hidden
    ->tileProvider('openstreetmap') // default options: openstreetmap, google, googleSatellite, googleTerrain, googleHybrid, esri
    ->customTiles([
        'mapbox' => [
            'url' => 'https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}',
            'options' => [
                'attribution' => '&copy; Mapbox',
                'id' => 'mapbox/streets-v11',
                'maxZoom' => 19,
                'accessToken' => 'YOUR_MAPBOX_TOKEN',
            ]
        ]
    ])
    ->customMarker([
        'iconUrl' => asset('pin-2.png'),
        'iconSize' => [38, 38],
        'iconAnchor' => [19, 38],
        'popupAnchor' => [0, -38]
    ])
```

### Infolist

[](#infolist)

```
use Afsakar\LeafletMapPicker\LeafletMapPickerEntry;

// Basic usage
LeafletMapPickerEntry::make('location')
    ->label('Location')

// Advanced usage with customization
LeafletMapPickerEntry::make('location')
    ->label('Property Location')
    ->height('500px')
    ->defaultLocation([41.0082, 28.9784])
    ->tileProvider('openstreetmap') // default options: openstreetmap, google, googleSatellite, googleTerrain, googleHybrid, esri
    ->hideTileControl()
    ->customTiles([
        'mapbox' => [
            'url' => 'https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}',
            'options' => [
                'attribution' => '&copy; Mapbox',
                'id' => 'mapbox/streets-v11',
                'maxZoom' => 19,
                'accessToken' => 'YOUR_MAPBOX_TOKEN',
            ]
        ]
    ])
    ->customMarker([
        'iconUrl' => asset('pin-2.png'),
        'iconSize' => [38, 38],
        'iconAnchor' => [19, 38],
        'popupAnchor' => [0, -38]
    ])
```

Screenshots
-----------

[](#screenshots)

Default: [![Screenshot](https://raw.githubusercontent.com/afsakar/filament-leaflet-map-picker/main/art/sc-default.png "Default")](https://raw.githubusercontent.com/afsakar/filament-leaflet-map-picker/main/art/sc-default.png)

Custom Marker: [![Screenshot](https://raw.githubusercontent.com/afsakar/filament-leaflet-map-picker/main/art/sc-custom-marker.png "Custom Marker")](https://raw.githubusercontent.com/afsakar/filament-leaflet-map-picker/main/art/sc-custom-marker.png)

Custom Tile: [![Screenshot](https://raw.githubusercontent.com/afsakar/filament-leaflet-map-picker/main/art/sc-custom-tile.png "Custom Tile")](https://raw.githubusercontent.com/afsakar/filament-leaflet-map-picker/main/art/sc-custom-tile.png)

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

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

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

[](#contributing)

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

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

[](#security-vulnerabilities)

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

Credits
-------

[](#credits)

- [Azad Furkan ŞAKAR](https://github.com/afsakar)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance77

Regular maintenance activity

Popularity36

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 77.1% 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 ~20 days

Recently: every ~38 days

Total

9

Last Release

228d ago

Major Versions

v1.3.0 → v2.0.0-beta2025-10-02

v2.0.0-beta → v3.x-dev2025-10-02

PHP version history (2 changes)v1.0.0PHP ^8.1

v2.0.0-betaPHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/1b40b7f308602075b99b5a258335ae711560c528f387f2abbb13f7a6e38a9a98?d=identicon)[afsakar](/maintainers/afsakar)

---

Top Contributors

[![afsakar](https://avatars.githubusercontent.com/u/75483091?v=4)](https://github.com/afsakar "afsakar (27 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (3 commits)")

---

Tags

laravelafsakarfilament-leaflet-map-picker

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/afsakar-filament-leaflet-map-picker/health.svg)

```
[![Health](https://phpackages.com/badges/afsakar-filament-leaflet-map-picker/health.svg)](https://phpackages.com/packages/afsakar-filament-leaflet-map-picker)
```

###  Alternatives

[codewithdennis/filament-select-tree

The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.

320392.1k17](/packages/codewithdennis-filament-select-tree)[ralphjsmit/laravel-filament-components

A collection of reusable components for Filament.

10972.2k2](/packages/ralphjsmit-laravel-filament-components)[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)[defstudio/filament-searchable-input

A searchable autocomplete input for Filament forms

3212.4k](/packages/defstudio-filament-searchable-input)[afsakar/filament-translate-action

Translate action for FilamentPHP

363.7k1](/packages/afsakar-filament-translate-action)[codebar-ag/laravel-filament-json-field

A Laravel Filament JSON Field integration with CodeMirror support

1124.1k](/packages/codebar-ag-laravel-filament-json-field)

PHPackages © 2026

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