Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Filament Map Field

Filament Map Field Laravel Package

lbcdev/filament-map-field

Filament Map Field adds Leaflet-powered map components for Filament v3/v4: MapField and MapEntry to pick/display coordinates, plus MapBoundsField/Entry for rectangular areas. Supports reactive updates, separate lat/lng fields, and nested JSON paths.

View on GitHub
Deep Wiki
Context7

Campo Filament para forms e infolists con mapa

Frequently asked questions about Filament Map Field
How do I integrate this package into an existing Filament v3/v4 Laravel project?
First, install via Composer: `composer require lbcdev/filament-map-field`. Then include Leaflet.js in your layout’s `<head>` for map functionality. The package works out-of-the-box with Filament’s form and infolist systems, requiring no additional configuration for basic usage.
Does this package support Laravel 12 and Filament v4?
Yes, this package is fully compatible with Laravel 12 and Filament v4. The README explicitly states backward compatibility between Filament v3 and v4, so no code changes are needed when upgrading. Always test thoroughly in your staging environment, though.
What map service does lbcdev/filament-map-field use, and are there licensing costs?
The underlying `lbcdev-map` Livewire component relies on Leaflet.js, an open-source library with no licensing fees. However, you may need to integrate additional map tile providers (e.g., OpenStreetMap, Mapbox) separately, which could incur costs depending on usage terms.
Can I use nested JSON fields like `ubicacion.latitud` with this package?
Yes, starting from version 1.1.0, the package supports nested JSON fields using dot notation (e.g., `ubicacion.latitud`). This reduces boilerplate for complex models and aligns with Laravel’s Eloquent relationships or JSON columns.
Will this package work if I don’t use Livewire in my project?
No, this package depends on Livewire (v3.x) and the `lbcdev/livewire-map-component`. If Livewire isn’t already in your stack, adding it solely for this package may introduce unnecessary complexity. Consider alternatives like Leaflet.js or Mapbox GL JS with custom form wrappers if Livewire isn’t a priority.
How do I handle form validation for map fields in Filament?
The package integrates seamlessly with Filament’s built-in validation system. You can validate latitude/longitude fields using standard Laravel rules (e.g., `required|numeric|between:-90,90` for latitude). For nested JSON fields, use dot notation in your validation rules (e.g., `ubicacion.latitud|required`).
Are there performance concerns with heavy map interactions in production?
Yes, complex map interactions (e.g., zooming, markers, or large datasets) can impact UI responsiveness. Test thoroughly in staging with realistic data volumes. Optimize by limiting initial map load regions, using lightweight tile providers, or implementing lazy-loading for non-critical maps.
Can I use this package for bulk operations or table actions in Filament?
The package is designed for form and infolist integration, not bulk operations. For table actions, you’d need to manually implement map previews or edits in custom Filament actions. Test edge cases like concurrent edits or form resets to ensure Livewire’s reactivity doesn’t conflict with Filament’s workflows.
What alternatives exist for map fields in Filament if I want to avoid Livewire?
Alternatives include integrating vanilla JS libraries like Leaflet.js or Mapbox GL JS directly into Filament forms using custom components. Packages like `spatie/laravel-geocoder` or `torann/laravel-geocoder` can complement spatial workflows, but they won’t provide the same out-of-the-box Filament integration as this package.
How do I migrate from text-based latitude/longitude fields to this map field?
Replace your existing text fields with `MapField` in Filament forms. For models with separate `latitude` and `longitude` columns, the package supports this natively. For JSON-stored coordinates, use the nested field syntax (e.g., `ubicacion.latitud`). Run migrations incrementally and validate data integrity post-upgrade.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
besmartand-pro/php-quality-config
sentix/ai-chatbot
terminal42/code-quality-tools
codifyo/ts-generator-bundle
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity