Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/diegobas/filament-drawable-map/llms.txt

Use this file to discover all available pages before exploring further.

Getting Filament Drawable Map running in your project takes only a few minutes. You will install the package via Composer, publish the configuration file, and supply your Google Maps API key through an environment variable. An optional step lets you publish the Blade views for deeper customization of the map field templates.
1

Require the package

Add the package to your Laravel project using Composer:
composer require diegobas/filament-drawable-map
2

Publish the config file

Publish the package configuration file so you can customize the default map location and API key settings:
php artisan vendor:publish --tag="filament-drawable-map-config"
This creates config/filament-drawable-map.php in your application.
3

Set your Google Maps API key

Add your Google Maps API key to your .env file. The Maps JavaScript API must be enabled for the key in the Google Cloud Console:
GOOGLE_MAPS_API_KEY=your_key_here
4

(Optional) Publish the Blade views

If you need to customize the map field templates, publish the package views to your resources/views/vendor directory:
php artisan vendor:publish --tag="filament-drawable-map-views"
The FilamentDrawableMapServiceProvider is registered automatically via Laravel’s package auto-discovery. You do not need to add it to config/app.php or call ->plugin() on your Filament panel.
This package does not register publishable migrations. Add the polygon column directly to your own model’s migration — typically a nullable JSON column such as $table->json('zone')->nullable(). See the Quickstart for a complete example.

Configuration File

After publishing, config/filament-drawable-map.php will contain the following defaults. Set GOOGLE_MAPS_API_KEY in your environment rather than hardcoding it here, and adjust the default location coordinates to a sensible center point for your application’s geography:
// config/filament-drawable-map.php
return [
    'providers' => [
        'google' => [
            'key' => env('GOOGLE_MAPS_API_KEY', null),
        ],
    ],
    'location' => [
        'latitude' => 39.500676,
        'longitude' => -0.439357,
    ],
];
The location values are used as the initial map center when no per-field location() override is provided.

Dependencies

DependencyRequired Version
php^8.0
filament/filament^3.0
spatie/laravel-package-tools^1.16
illuminate/contracts^9.0 | ^10.0 | ^11.0

Build docs developers (and LLMs) love