larswiegers/laravel-maps
Easily add maps to your Laravel app with Leaflet or Google Maps. Render basic maps with center points, zoom, markers, bounds (Google), and custom tile hosts like OpenStreetMap or Mapbox. Publish views to customize map output.
Architecture fit: The package now provides deeper integration with Leaflet.js via custom event dispatching (exposing the Leaflet instance), enabling advanced use cases like reacting to map events (e.g., move, click, zoom) in a Laravel-centric way. This aligns well with Laravel’s Blade component ecosystem while extending functionality beyond static map rendering. The addition of Laravel 13.x compatibility ensures long-term viability with modern Laravel versions.
Integration feasibility: High. The package abstracts Leaflet.js complexity while exposing core functionality (e.g., event handling) via a Laravel-friendly API. Custom events allow for seamless integration with frontend frameworks (e.g., Alpine.js, Inertia.js) or custom JS logic without direct Leaflet.js exposure.
Technical risk:
Key questions:
Stack fit:
document.addEventListener('leaflet-map-ready', (e) => {
e.detail.map.on('click', (event) => { /* Handle click */ });
});
Migration path:
leaflet and google-maps packages are compatible with the new release.Compatibility:
Sequencing:
Maintenance:
Support:
e.detail.map in browser console to inspect Leaflet instances.Scaling:
Failure modes:
| Risk | Mitigation | Workaround |
|---|---|---|
| Broken event dispatching | Test in staging with mock events. | Fallback to direct JS listeners. |
| Laravel 13.x breaking change | Feature flags for new Blade syntax. | Downgrade package version. |
| Google Maps API throttling | Implement caching for static maps. | Use Leaflet’s offline mode. |
Ramp-up:
map.on('click', ...) with Laravel events").mix or Vite to bundle Leaflet with custom event handlers.<x-map :events="['click' => 'handleMapClick']" />
function handleMapClick(event) { /* ... */ }
How can I help you explore Laravel packages today?