- How do I install larswiegers/laravel-maps in a Laravel project?
- Run composer require larswiegers/laravel-maps and then drop the package's Blade component tag into any view. There are no migrations or required config files, and the service provider is auto-discovered. For Google Maps set MAPS_GOOGLE_MAPS_ACCESS_TOKEN in your .env file, and add MAPS_MAPBOX_ACCESS_TOKEN if you use Mapbox tiles, or pass tokens per component. Publishing the views is optional and only needed if you want to change the markup.
- Does laravel-maps support both Leaflet.js and Google Maps?
- Yes. Leaflet is the simpler default and supports multiple maps on the same page, while Google Maps adds multiple map types, bounds and info windows but is limited to one map per page. Both support a center point, basic markers, zoom levels and custom tile hosts. Pick per component depending on which features you need.
- Can I use laravel-maps inside Livewire or Filament?
- No, Livewire is explicitly unsupported and the README points to an open issue with community workarounds. Teams building on Livewire, Filament or heavy Alpine interactivity should budget this as a custom integration rather than a drop-in component. Because the package renders static HTML and JavaScript, re-rendering a map inside a Livewire component means managing the underlying map instance yourself.
- How do I add markers to a map with laravel-maps?
- Markers are passed as attributes on the component tag, along with per-marker options such as icons, labels and info windows. The README lists the exact attribute names and covers the common cases. Watch out for one documented papercut: double quotes inside attribute values must be backslash-escaped, which otherwise produces confusing Blade template errors.
- Which Laravel and PHP versions does laravel-maps support?
- The composer.json constraints on Packagist are the authoritative source, so check those before committing to an upgrade. In practice the package is an anonymous Blade component plus a service provider, so it needs a Laravel release that supports anonymous components, meaning Laravel 8 or newer. It ships no migrations, queues or events, so there is little else to conflict with your stack.
- Why can I only render one Google Map per page with laravel-maps?
- That is a hard limit of the Google Maps integration, not a configuration problem, since Google Maps only allows one map per page. Leaflet supports multiple maps on the same page as long as each one gets an explicit ID. Plan dashboard layouts around this, or switch to Leaflet wherever several maps must coexist.
- How do I set or change the tile provider in laravel-maps?
- OpenStreetMap is the default and needs no configuration, but its usage policy does not tolerate production-scale traffic. Mapbox requires a free key in MAPS_MAPBOX_ACCESS_TOKEN plus mandatory attribution, and choosing Google Maps turns tile sourcing into a billing relationship. Tile hosts are third-party dependencies, so set them per component or via env and review each provider's terms before you go live.
- How do I stop laravel-maps from breaking when Leaflet releases a new version?
- Release 0.15 moved Leaflet to "latest" by default and the changelog itself warns this might break your application, so pin leafletVersion explicitly on your components. Treat Leaflet upgrades as deliberate, browser-tested changes instead of incidental version bumps. The package's own tests only assert on rendered HTML, so CDN or upstream API changes will not be caught in CI.
- How do I customize the map Blade views in laravel-maps?
- Run php artisan vendor:publish --provider="Larswiegers\LaravelMaps\LaravelMapsServiceProvider" to copy the views into your application, then edit them as needed. Be aware this is a fork-by-copy model: once published, upstream view improvements no longer reach you automatically. Record that trade-off in your decision notes and use per-component attributes for smaller tweaks.
- Can laravel-maps do geocoding, clustering, or distance calculations?
- No. The package is a thin Blade component layer over Leaflet.js and Google Maps, so geocoding, clustering, heatmaps, routing, geofencing and proximity search are all out of scope and must be sourced elsewhere. Server-side spatial queries are not part of it either. Triage feature requests against that boundary early, because stakeholders often assume a maps package implies more than it delivers.