ux-map

Solid

Symfony UX Map for interactive maps with Leaflet or Google Maps in Symfony. Covers markers, polygons, polylines, circles, info windows, and LiveComponent integration. Use when displaying maps, placing markers, drawing shapes or routes, handling map events, building store locators, using custom tile layers, or making maps reactive with LiveComponent. Code triggers: <twig:ux:map />, Map(), Point(), Marker(), Polygon(), Polyline(), Circle(), InfoWindow(), MapOptionsInterface, ComponentWithMapTrait, fitBoundsToMarkers, ux:map:marker:before-create, ux:map:connect, SYMFONY_UX_MAP_DSN. Also trigger when the user asks "how to display a map", "how to add markers", "how to draw a polygon on a map", "how to handle map click events", "how to make a reactive map", "how to use Leaflet in Symfony", "how to use Google Maps in Symfony", "map not showing", "map has zero height". Do NOT trigger for SVG icons (use ux-icons) or general frontend interactivity (use stimulus).

Web & Frontend 158 stars 11 forks Updated yesterday MIT

Install

View on GitHub

Quality Score: 90/100

Stars 20%
73
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# UX Map Interactive maps in Symfony with Leaflet or Google Maps. Build maps in PHP, render them in Twig, and extend them with Stimulus controllers. Supports markers, polygons, polylines, circles, info windows, and LiveComponent integration. ## Installation ```bash # Install the base package composer require symfony/ux-map # Then install ONE renderer: composer require symfony/ux-leaflet-map # Leaflet (free, open source) # OR composer require symfony/ux-google-map # Google Maps (requires API key) ``` ## Quick Reference ``` Map PHP object, holds markers/shapes/options Point latitude + longitude Marker pin on the map, optional InfoWindow Polygon closed shape (array of Points) Polyline open line (array of Points) Circle center Point + radius in meters InfoWindow popup attached to a Marker, Polygon, or Circle ux_map(map, attrs) Twig function to render a Map <twig:ux:map /> Twig component (requires ux-twig-component) ``` ## Building a Map in PHP ```php use Symfony\UX\Map\Map; use Symfony\UX\Map\Point; use Symfony\UX\Map\Marker; use Symfony\UX\Map\InfoWindow; use Symfony\UX\Map\Polygon; use Symfony\UX\Map\Polyline; use Symfony\UX\Map\Circle; $map = (new Map()) ->center(new Point(48.8566, 2.3522)) ->zoom(12) ->minZoom(3) ->maxZoom(18); // Marker with info window $map->addMarker(new Marker( position: new Point(48.8566, 2.3522), ...

Details

Author
smnandre
Repository
smnandre/symfony-ux-skills
Created
3 months ago
Last Updated
yesterday
Language
N/A
License
MIT

Related Skills