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.
composer require larswiegers/laravel-maps.<x-maps-leaflet /> or <x-maps-google :centerPoint="['lat' => ..., 'long' => ...]" /> in your Blade template..env: MAPS_GOOGLE_MAPS_ACCESS_TOKEN=....MAPS_MAPBOX_ACCESS_TOKEN=... in .env.php artisan vendor:publish --provider="Larswiegers\LaravelMaps\LaravelMapsServiceProvider".: prefix for JSON-encoded attributes (e.g., :markers="$markers").id attributes to each component (<x-maps-leaflet id="store-map" ...>).:fitToBounds="true" for auto-zooming to fit all markers, :centerToBoundsCenter="true" for mid-point centering, and label/icon/info on markers for rich UI—enabled by Google’s Advanced Markers.resources/views/vendor/laravel-maps/components/leaflet.blade.php) to inject custom CSS, event listeners, or extra JavaScript without forking the package.MAPS_MAPBOX_ACCESS_TOKEN or passing tileUrl via attributes.<x-maps-google> per page to avoid conflicts.\", e.g., :info="'This is \\\"important\\\"'".leafletVersion="1.9.4" to pin versions and avoid breaking changes.:attribution="..." if using custom text or omitting default.Livewire.hook('message.processed', ...)—but consider server-side rendering alternatives (e.g., caching static map images).->assertSee('<div id="leaflet-map">') in feature tests to verify rendering, but note current tests only validate HTML output—not client-side behavior..env, and ensure Google Maps API has only the Maps JavaScript API enabled (avoid enabling unnecessary APIs to reduce billing risk).How can I help you explore Laravel packages today?