- Can I use krixer/google-map-form-type-bundle in a Laravel application?
- No. It is a Symfony bundle built on symfony/form, symfony/framework-bundle, the Symfony DI container, and Twig bundle asset publishing, none of which run inside Laravel. There is no adapter, bridge, or headless mode, so the form type cannot be reused as a Composer dependency in a Laravel app. Treat it as a design reference instead.
- How do I install and register this Google Maps form type in Symfony?
- Install it with Composer, then enable the bundle in config/bundles.php for a Symfony 4 or 5 application. Set your Google Maps API key in the bundle configuration and add the custom form type to an existing entity form. The bundle publishes its JavaScript under Resources/public, so you also need to run the asset install command. First render in a legacy Symfony app is roughly 30 minutes of work.
- Does this bundle support Symfony 6 or 7, or Laravel 9 to 11?
- Laravel support is nonexistent because the package is Symfony-only. Symfony 6 and 7 compatibility is unverified: the last release was 2021-03-29 and targets Symfony 5-era AbstractType signatures and option resolvers. Expect to spike or fork before trusting it on a modern Symfony version. The bundled JavaScript also predates the Google Maps AdvancedMarkerElement migration.
- How does the bundle bind latitude and longitude to my entity?
- It exposes an AbstractType subclass with latitude and longitude form children plus a Twig template that embeds the Google Maps JavaScript API. A small script binds marker drag events to two hidden inputs so the selected coordinates submit with the form. Symfony's form mapper then hydrates your entity properties as floats. The package does no bounds checking, nullability handling, precision control, or coordinate normalization, so you must enforce those rules yourself.
- Is krixer/google-map-form-type-bundle maintained and safe for production?
- Effectively no. It has 9 stars, 0 dependents, a single maintainer with no visible cadence, and a last release of 2021-03-29. Any fix becomes your fork, and the bundled JavaScript likely uses the deprecated google.maps.Marker path rather than AdvancedMarkerElement. Google Maps pricing and free-tier rules have also changed since 2021. For a production Laravel service, the risk outweighs the roughly 150 to 250 lines of usable code.
- What is the best Laravel alternative to this Symfony Google Maps form type?
- Build a small in-house component rather than porting the bundle. A Blade partial or Livewire component renders a map container plus hidden latitude and longitude inputs, and one Vite JavaScript module handles map init, marker placement, drag sync, and initial state. Put the provider key in config/maps.php and validate coordinates with a FormRequest. The build is typically 1 to 3 days and lets you target Leaflet with OpenStreetMap or Mapbox instead of Google.
- Does the bundle provide geocoding or reverse geocoding for addresses?
- No. It is a UI widget only and contributes no server-side logic of substance: no geocoding, no reverse lookup, no validation, and no persistence layer. If you need address-to-coordinate or coordinate-to-address conversion, call the Google Geocoding API from your backend with a restricted server key or a proxy. That work is entirely outside this package.
- How should I handle the Google Maps API key and billing exposure with this package?
- The bundle places the key in application config and renders it into client-side JavaScript, which is expected for the Maps JavaScript API. You must add HTTP referrer restrictions to that key and keep any server-side Geocoding calls on a separate, IP-restricted key or proxy, neither of which the package addresses. Map loads are billable, so estimate expected volume before launch. Leaflet plus OpenStreetMap removes per-load billing and vendor lock entirely if the provider is not mandated.
- Can I reuse the bundle's Twig template and JavaScript in Laravel Blade?
- Only as a reference implementation. The interaction pattern of map container, two hidden inputs, and marker drag sync translates cleanly to a Blade partial and a Vite module, but the Twig namespace registration, asset-publish command, and Symfony service provider have no Laravel analogues. Rewrite the template rather than porting it, and modernize the marker code for AdvancedMarkerElement or switch to Leaflet. Do not add the Composer package to a Laravel project just to copy the files.
- How do I test a Google Maps location picker in Laravel?
- Do not hit the live Maps API in tests. Assert the server-side contract: latitude and longitude are required or nullable as specified, numeric, within -90 to 90 and -180 to 180, and stored at the precision your column defines. Test the JavaScript sync separately with a mocked map object or a browser test that sets the hidden inputs directly. Because the bundle enforces no coordinate validation contract, those rules are yours to write and test.