petrepatrasc/google-map
A PHP package for integrating Google Maps into your application, providing a simple wrapper for embedding maps, working with locations, and connecting to Google Maps services. Suitable for Laravel or standalone PHP projects that need map rendering and geodata support without boilerplate.
What this package actually is. Despite the "Google Map API v3 integration" description, this is not a server-side client for Google's web services (Geocoding, Directions, Places, Distance Matrix). It appears to be a fork of the egeloen/ivory-google-map standalone PHP library: an object-oriented builder that models map entities (Map, Marker, InfoWindow, Polyline, Polygon, Circle, Rectangle, GroundOverlay, KmlLayer, controls, events, styles) and renders them to HTML/JavaScript for the client-side Google Maps JavaScript API v3. That distinction drives most of the assessment below: the library is a view-layer code generator, not a data-access layer.
Architecture fit. Reasonable fit only if we place it where it belongs — in the presentation tier, behind a Blade component or a small view-model, never inside domain services or jobs. It has no Laravel coupling (no service provider, no facade, no config), so it imposes no framework constraints and can be dropped into a app/Support/Maps namespace without contaminating the rest of the codebase. Its declarative builder API is genuinely nicer than hand-writing map init scripts, which is the one real argument in its favor.
Integration feasibility. Low ceremony: one Composer dependency, MIT licensed, no native extensions, no runtime services. Rendering into Blade is a single unescaped-output call. The friction is concentrated in four places: (1) the package predates PSR-4, so autoloading and namespace layout need verification; (2) it emits inline <script> blocks, which conflicts with a nonce- or hash-based Content Security Policy and with asset ordering assumptions; (3) it embeds nothing about API key management, so key injection is our problem; (4) PHP version support is unstated and almost certainly predates 8.x.
Technical risk. Three tiers, in ascending order of severity:
each(), create_function, curly-brace string offsets, dynamic properties). This is auditable and fixable in hours, not weeks, but it is our hours forever.google.maps.Marker, which this library's Marker class almost certainly emits, is deprecated in favor of AdvancedMarkerElement, which requires a Map ID and a different construction path. Legacy overlays and controls still function but accumulate console deprecation warnings and will eventually stop receiving features. Any library that hard-codes constructor calls into strings will drift out of alignment with the platform.Key questions to resolve before committing:
E_ALL? What breaks?Map, Marker, InfoWindow, Polyline, and clustering? If it's five classes, the fork burden is trivial and the adoption case improves.AdvancedMarkerElement, cloud-based map styling, or Map IDs? If yes, the package's Marker abstraction is already obsolete and we're writing a wrapper around it anyway.Marker)?Stack fit. Compatible in principle with any Laravel 8+ application, but only if the PHP-level issues are resolved first. The natural seam is a Blade component (<x-map :markers="$markers" />) backed by a small view-model that translates application data into the library's builder calls. That seam is what makes the choice reversible: if we later swap the library out, we rewrite one class, not every view. Nothing about the package should leak into controllers or models.
Migration path. Three options, and I'd present all three rather than defaulting to the dependency:
1.0.0. Cost: a few days. Preserves the builder API. Ongoing cost: the fork is ours.MapBuilder interface. Insulates callers from upstream abandonment and gives a clean swap point.Map DTO, a marker serializer to JSON, and a Blade partial. Cost: comparable to the fork, but we own the output, get CSP support and AdvancedMarkerElement for free, and carry no dead code.Given 0 stars and 0 dependents, Option A is the least defensible default. The decision should hinge on how many entity types we genuinely use — audit that in the spike, not in the abstract.
Compatibility. Pin the fork to a known-good PHP range and assert it in CI (8.1 through current). Snapshot-test the rendered output as golden files so that PHP-level fixes or Google API changes surface as diffs rather than as silent breakage in production. Verify the library's JS output against the currently pinned Maps JS API version parameter (v=weekly vs. a fixed quarterly release) — pinning the API version is the cheap defense against platform drift.
Sequencing.
MapData input object. This is the only interface application code ever sees.Maintenance. The true cost is fork ownership, not the initial integration. Dependabot and similar tooling will not generate meaningful upstream PRs; every PHP minor release and every Google platform change becomes a manual audit against our tree. Budget a recurring half-day per quarter for compatibility checks, plus a full day whenever Google announces a Maps JS API deprecation. Store the fork with the same CI, linting, and static analysis standards as first-party code, or it will rot invisibly — that is the single most common failure mode for adopted-and-forgotten packages.
Support. Internal-only. There is no upstream to escalate to, no issue tracker with traffic, and no maintainer relationship to lean on. That is acceptable for a view-layer renderer and unacceptable if it ever creeps into a business-critical path. Document the fork's ownership explicitly in the repo README so it does not become orphaned when the adopting engineer changes teams.
Scaling. Server-side cost is effectively zero — the library performs no network I/O and allocates only the object graph for one page render. All real scaling pressure is client-side and financial: number of markers per map, clustering strategy at high marker counts, tile and Dynamic Maps load volume, and per-API quota consumption. The Maps JS API bills per map load, so a high-traffic page with an above-the-fold map is a recurring cost line, not a one-time integration. Cache nothing here — but do consider lazy-loading the map on scroll or click-to-load to suppress loads that users never see.
Failure modes. Enumerate them explicitly, because most are silent:
Marker continues to work but loses features and eventually support; the failure is gradual and feature-specific rather than a clean break.Ramp-up. Low for the happy path — a developer familiar with the Google Maps JS API will read the builder classes in an afternoon, and the object model mirrors the JS API closely enough to be guessable. Moderate for the operational side: API key restrictions, quota policy, CSP interaction, and version pinning are the parts that cause incidents, and none of them are visible from the library's API. Mitigate with a short internal cookbook covering the three or four map patterns we actually ship, plus a checklist for adding a new map to a page. Do not let engineers construct maps ad hoc in Blade — the wrapper exists precisely to prevent that.
How can I help you explore Laravel packages today?