Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Google Map Laravel Package

arcasolutions/google-map

Laravel package providing Google Maps integration for your app, with helpers to generate map views and include the required scripts. Useful for quickly embedding maps and configuring markers or map options within Laravel projects.

View on GitHub
Deep Wiki
Context7

JS Container

When you call $mapHelper->renderJavascripts($map), the library will generate for you all needed JS code for displaying your map. Obviously, it is not the anarchy, all the sheet is organized in order to reuse created objects in the client side (your JS scripts).

As explain in the doc, a map has a javascript variable which is used to render the code. For example, you have a map with my_map as javascript variable, then the output will be:

my_map = new new google.maps.Map(/* ... */);

There is many objects which have a javascript variable (coordinates, markers, etc). All these objects are rendered like a map (except for the instanciation part :)). So, you can use every objects though his javascript variable.

Additionally, a container is builded for each map in order to more easily reuse all the related objects of a map instead of directly relying on each javascript variable. For a map named my_map, the output will be:

my_map_container = {
    // Base
    "coordinates": {},
    "bounds": {},
    "points: {},
    "sizes": {},

    // Map
    map: null,

    // Overlays
    "circles": {},
    "encoded_polylines": {},
    "ground_overlays": {},
    "polygons": {},
    "polylines": {},
    "rectangles": {},
    "info_windows": {},
    "marker_images": {},
    "marker_shapes": {},
    "markers": {},
    "marker_cluster": null,

    // Layers
    "kml_layers": {},

    // Event Manager
    "event_manager": {
        "dom_events": {},
        "dom_events_once": {},
        "events": {},
        "events_once": {}
    },

    // Internal
    "closable_info_windows": {}
    "functions": {
        "to_array": function { /* ... */ }
    }
}

Each objects is aliased by his javascript variable in the container. If you have a circle named "my_circle", then you can access it like that:

var my_circle = my_map_container.circles.my_circle;

If you want to iterate all markers on you map, you can easily archieve it:

for (marker in my_map_container.markers) {
    var my_marker = my_map_container.markers[marker];

    // Do what you want with your marker...
}
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky