{"id":13608414,"url":"https://github.com/bradcornford/Googlmapper","last_synced_at":"2025-04-12T17:31:27.235Z","repository":{"id":26142356,"uuid":"29587426","full_name":"bradcornford/Googlmapper","owner":"bradcornford","description":"An easy way to integrate Google Maps with Laravel","archived":false,"fork":false,"pushed_at":"2023-03-02T14:14:46.000Z","size":314,"stargazers_count":461,"open_issues_count":31,"forks_count":144,"subscribers_count":23,"default_branch":"master","last_synced_at":"2025-04-07T20:06:14.954Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bradcornford.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2015-01-21T11:57:15.000Z","updated_at":"2025-04-04T15:14:51.000Z","dependencies_parsed_at":"2024-01-17T07:08:06.485Z","dependency_job_id":"4fc13e2d-4b56-4d77-86c7-d3f5a6727619","html_url":"https://github.com/bradcornford/Googlmapper","commit_stats":null,"previous_names":[],"tags_count":190,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bradcornford%2FGooglmapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bradcornford%2FGooglmapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bradcornford%2FGooglmapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bradcornford%2FGooglmapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bradcornford","download_url":"https://codeload.github.com/bradcornford/Googlmapper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248605060,"owners_count":21132104,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T19:01:27.074Z","updated_at":"2025-04-12T17:31:22.214Z","avatar_url":"https://github.com/bradcornford.png","language":"PHP","funding_links":[],"categories":["PHP","Packages"],"sub_categories":["GIS/Mapping"],"readme":"# An easy way to integrate Google Maps with Laravel\n\n[![Latest Stable Version](https://poser.pugx.org/cornford/Googlmapper/version.png)](https://packagist.org/packages/cornford/googlmapper)\n[![Total Downloads](https://poser.pugx.org/cornford/googlmapper/d/total.png)](https://packagist.org/packages/cornford/googlmapper)\n[![Build Status](https://travis-ci.org/bradcornford/Googlmapper.svg?branch=master)](https://travis-ci.org/bradcornford/Googlmapper)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/bradcornford/Googlmapper/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/bradcornford/Googlmapper/?branch=master)\n\n### For Laravel 5.x, check [version 2.35.1](https://github.com/bradcornford/Googlmapper/tree/v2.35.1)\n\n### For Laravel 4.x, check [version 1.27.0](https://github.com/bradcornford/Googlmapper/tree/v1.27.0)\n\nThink of Googlmapper as an easy way to integrate Google Maps with Laravel, providing a variety of helpers to speed up the utilisation of mapping. These include:\n\n- `Mapper::map`\n- `Mapper::location`\n- `Mapper::streetview`\n- `Mapper::marker`\n- `Mapper::informationWindow`\n- `Mapper::polyline`\n- `Mapper::polygon`\n- `Mapper::rectangle`\n- `Mapper::circle`\n- `Mapper::render`\n\n## Installation\n\nBegin by installing this package through Composer. Edit your project's `composer.json` file to require `cornford/googlmapper`.\n\n\t\"require\": {\n\t\t\"cornford/googlmapper\": \"3.*\"\n\t}\n\nNext, update Composer from the Terminal:\n\n\tcomposer update\n\nOnce this operation completes, the next step is to add the service provider. Open `app/config/app.php`, and add a new item to the providers array.\n\n\tCornford\\Googlmapper\\MapperServiceProvider::class,\n\nThe next step is to introduce the facade. Open `app/config/app.php`, and add a new item to the aliases array.\n\n\t'Mapper'         =\u003e Cornford\\Googlmapper\\Facades\\MapperFacade::class,\n\nFinally we need to introduce the configuration files into your application.\n\n\tphp artisan vendor:publish --provider=\"Cornford\\Googlmapper\\MapperServiceProvider\" --tag=googlmapper\n\nYou also need to set your Google API Key into the `GOOGLE_API_KEY` environment variable. To obtain an API key for your project, visit the [Google developers console](https://console.developers.google.com/).\n\nThat's it! You're all set to go.\n\n## Configuration\n\nYou can now configure Googlmapper in a few simple steps. Open `app/config/packages/cornford/googlmapper/config.php` and update the options as needed.\n\n- `enabled` - Enable Google Maps.\n- `key` - A Google Maps API key.\n- `region` - A region Google Maps should utilise, required in ISO 3166-1 code format, e.g. GB.\n- `language` - A language Google Maps should utilise, required in ISO 639-1 code format, e.g. en-gb.\n- `async` - Perform the loading and rendering of Googlmapper map asynchronously, e.g. false.\n- `marker` - Automatically add Google Maps marker for your maps initial location, e.g. true.\n- `center` - Automatically center Google Maps around the initial location, when false, Google Maps will automatically center the map, e.g. true.\n- `locate` - Automatically center Google Maps around the users current location, when false, Google Maps will automatically center the map, e.g. true.\n- `zoom` - Set the default zoom level for Google Maps, e.g. 8.\n- `scrollWheelZoom` - Set the default scroll wheel zoom Google Maps, e.g. true.\n- `zoomControl` - Set the default zoom control for Google Maps, e.g. true.\n- `mapTypeControl` - Set the default map type control for Google Maps, e.g. true.\n- `scaleControl` - Set the default scale control for Google Maps, e.g. true.\n- `streetViewControl` - Set the default street view control for Google Maps, e.g. true.\n- `rotateControl` - Set the default rotate control for Google Maps, e.g. true.\n- `fullscreenControl` - Set the default fullscreen control for Google Maps, e.g. true.\n- `gestureHandling` - Set the default gesture handling for Google Maps, e.g. auto, none, cooperative, greedy.\n- `type` - Set the default map type for Google Maps, e.g. ROADMAP, SATELLITE, HYBRID, TERRAIN.\n- `ui` - Show the Google Maps default UI options, e.g. true.\n- `markers.icon` - Set the default marker icon, e.g. img/icon.png.\n- `markers.animation` - Set the default marker animation, e.g. NONE, DROP, BOUNCE.\n- `markers.autoClose` - Automatically close Information Windows of current marker when other markers are clicked, e.g. true.\n- `cluster` - Set if map marker clusters should be used.\n- `clusters.icon` - Display custom images for clusters using icon path.\n- `clusters.grid` - The grid size of a cluster in pixels.\n- `clusters.zoom` - The maximum zoom level that a marker can be part of a cluster.\n- `clusters.center` - Whether the center of each cluster should be the average of all markers in the cluster.\n- `clusters.size` - The minimum number of markers to be in a cluster before the markers are hidden and a count is shown.\n\n## Usage\n\nIt's really as simple as using the Mapper class in any Controller / Model / File you see fit with:\n\n`Mapper::`\n\nThis will give you access to\n\n- [Map](#map)\n- [Location](#location)\n- [Streetview](#streetview)\n- [Marker](#marker)\n- [Information Window](#information-window)\n- [Polyline](#polyline)\n- [Polygon](#polygon)\n- [Rectangle](#rectangle)\n- [Circle](#circle)\n- [Render](#render)\n- [RenderJavascript](#renderjavascript)\n\n### Example\n\nInitialize the map in your controller `MapController.php`:\n\n\tuse Mapper;\n\n\tpublic function index()\n\t{\n\t\tMapper::map(53.381128999999990000, -1.470085000000040000);\n\n\t\treturn view('map')\n\t}\n\nWithin in the view `map.blade.php` add following code to render the map:\n\n\t\u003cdiv style=\"width: 500px; height: 500px;\"\u003e\n\t\t{!! Mapper::render() !!}\n\t\u003c/div\u003e\n\n### Map\n\nThe `map` method allows a map to be created, with latitude, longitude and optional parameters for options.\n\n\tMapper::map(53.381128999999990000, -1.470085000000040000);\n\tMapper::map(53.381128999999990000, -1.470085000000040000, ['zoom' =\u003e 15, 'center' =\u003e false, 'marker' =\u003e false, 'type' =\u003e 'HYBRID', 'overlay' =\u003e 'TRAFFIC']);\n\tMapper::map(53.381128999999990000, -1.470085000000040000, ['zoom' =\u003e 10, 'markers' =\u003e ['title' =\u003e 'My Location', 'animation' =\u003e 'DROP']]);\n\tMapper::map(53.381128999999990000, -1.470085000000040000, ['zoom' =\u003e 10, 'markers' =\u003e ['title' =\u003e 'My Location', 'animation' =\u003e 'DROP'], 'cluster' =\u003e false]);\n\tMapper::map(53.381128999999990000, -1.470085000000040000, ['zoom' =\u003e 10, 'markers' =\u003e ['title' =\u003e 'My Location', 'animation' =\u003e 'DROP'], 'clusters' =\u003e ['size' =\u003e 10, 'center' =\u003e true, 'zoom' =\u003e 20]]);\n\n##### Map Events\n\n**Before Load**\n\nThis event is fired before the map is loaded.\n\n\tMapper::map(53.381128999999990000, -1.470085000000040000, ['eventBeforeLoad' =\u003e 'console.log(\"before load\");']);\n\n**After Load**\n\nThis event is fired after the map is loaded.\n\n\tMapper::map(53.381128999999990000, -1.470085000000040000, ['eventAfterLoad' =\u003e 'console.log(\"after load\");']);\n\n### Location\n\nThe `location` method allows a location to be searched for with a string, returning a Location object with its latitude and longitude.\n\n\tMapper::location('Sheffield');\n\tMapper::location('Sheffield')-\u003emap(['zoom' =\u003e 15, 'center' =\u003e false, 'marker' =\u003e false, 'type' =\u003e 'HYBRID', 'overlay' =\u003e 'TRAFFIC']);\n\tMapper::location('Sheffield')-\u003estreetview(1, 1, ['ui' =\u003e false]);\n\n### Streetview\n\nThe `streetview` method allows a streetview map to be created, with latitude, longitude, heading, pitch and optional parameters for options.\n\n\tMapper::streetview(53.381128999999990000, -1.470085000000040000, 1, 1);\n\tMapper::streetview(53.381128999999990000, -1.470085000000040000, 1, 1, ['ui' =\u003e false]);\n\n### Marker\n\nThe `marker` method allows a marker to be added to a map, with latitude, longitude, and optional parameters for options.\n\n\tMapper::marker(53.381128999999990000, -1.470085000000040000);\n\tMapper::marker(53.381128999999990000, -1.470085000000040000, ['animation' =\u003e 'DROP', 'label' =\u003e 'Marker', 'title' =\u003e 'Marker', 'draggable' =\u003e true]);\n\tMapper::marker(53.381128999999990000, -1.470085000000040000, ['icon' =\u003e 'https://chart.googleapis.com/chart?chst=d_map_pin_letter\u0026chld=|FE6256|000000']);\n\tMapper::marker(53.381128999999990000, -1.470085000000040000, ['icon' =\u003e ['url' =\u003e 'https://chart.googleapis.com/chart?chst=d_map_pin_letter\u0026chld=|FE6256|000000', 'scale' =\u003e 100]]);\n\tMapper::map(52.381128999999990000, 0.470085000000040000, ['markers' =\u003e ['icon' =\u003e ['symbol' =\u003e 'CIRCLE', 'scale' =\u003e 10], 'animation' =\u003e 'DROP', 'label' =\u003e 'Marker', 'title' =\u003e 'Marker']])-\u003emarker(53.381128999999990000, -1.470085000000040000);\n\tMapper::marker(53.381128999999990000, -1.470085000000040000, [\n\t\t'title' \t=\u003e 'title',\n\t\t'icon'      =\u003e [\n\t\t\t'path'         =\u003e 'M10.5,0C4.7,0,0,4.7,0,10.5c0,10.2,9.8,19,10.2,19.4c0.1,0.1,0.2,0.1,0.3,0.1s0.2,0,0.3-0.1C11.2,29.5,21,20.7,21,10.5 C21,4.7,16.3,0,10.5,0z M10.5,5c3,0,5.5,2.5,5.5,5.5S13.5,16,10.5,16S5,13.5,5,10.5S7.5,5,10.5,5z',\n\t\t\t'fillColor'    =\u003e '#DD716C',\n\t\t\t'fillOpacity'  =\u003e 1,\n\t\t\t'strokeWeight' =\u003e 0,\n\t\t\t'anchor'       =\u003e [0, 0],\n\t\t\t'origin'       =\u003e [0, 0],\n\t\t\t'size'         =\u003e [21, 30]\n\t\t],\n\t\t'label'     =\u003e [\n\t\t\t'text' =\u003e 'Marker',\n\t\t\t'color' =\u003e '#B9B9B9',\n\t\t\t'fontFamily' =\u003e 'Arial',\n\t\t\t'fontSize' =\u003e '13px',\n\t\t\t'fontWeight' =\u003e 'bold',\n\t\t],\n\t\t'autoClose' =\u003e true,\n\t\t'clickable' =\u003e false,\n\t\t'cursor' =\u003e 'default',\n\t\t'opacity' =\u003e 0.5,\n\t\t'visible' =\u003e true,\n\t\t'zIndex' =\u003e 1000,\n\t]);\n\n#### Draggable Markers\n\nIf you need draggable marker, you can add option draggable. \n\n\tMapper::marker(53.381128999999990000, -1.470085000000040000, ['draggable' =\u003e true]);\n\n##### Draggable Events\n\n**Click**\n\nThis event is fired when the marker icon was clicked.\n\n\tMapper::marker(53.381128999999990000, -1.470085000000040000, ['draggable' =\u003e true, 'eventClick' =\u003e 'console.log(\"left click\");']);\n\n**Double Click**\n\nThis event is fired when the marker icon was double clicked.\n\n\tMapper::marker(53.381128999999990000, -1.470085000000040000, ['draggable' =\u003e true, 'eventDblClick' =\u003e 'console.log(\"double left click\");']);\n\n**Right Click**\n\nThis event is fired for a right click on the marker.\n\n\tMapper::marker(53.381128999999990000, -1.470085000000040000, ['draggable' =\u003e true, 'eventRightClick' =\u003e 'console.log(\"right click\");']);\n\n**Mouse Over**\n\nThis event is fired when the mouse enters the area of the marker icon.\n\n\tMapper::marker(53.381128999999990000, -1.470085000000040000, ['draggable' =\u003e true, 'eventMouseOver' =\u003e 'console.log(\"mouse over\");']);\n\n**Mouse Down**\n\nThis event is fired for a mouse down on the marker.\n\n\tMapper::marker(53.381128999999990000, -1.470085000000040000, ['draggable' =\u003e true, 'eventMouseDown' =\u003e 'console.log(\"mouse down\");']);\n\n**Mouse Up**\n\nThis event is fired for a mouse up on the marker.\n\n\tMapper::marker(53.381128999999990000, -1.470085000000040000, ['draggable' =\u003e true, 'eventMouseUp' =\u003e 'console.log(\"mouse up\");']);\n\n**Mouse Out**\n\nThis event is fired when the mouse leaves the area of the marker icon.\n\n\tMapper::marker(53.381128999999990000, -1.470085000000040000, ['draggable' =\u003e true, 'eventMouseOut' =\u003e 'console.log(\"mouse out\");']);\n\n**Drag**\n\nThis event is repeatedly fired while the user drags the marker.\n\n\tMapper::marker(53.381128999999990000, -1.470085000000040000, ['draggable' =\u003e true, 'eventDrag' =\u003e 'console.log(\"dragging\");']);\n\n**Drag Start**\n\nThis event is fired when the user starts dragging the marker.\n\n\tMapper::marker(53.381128999999990000, -1.470085000000040000, ['draggable' =\u003e true, 'eventDragStart' =\u003e 'console.log(\"drag start\");']);\n\n**Drag End**\n\nThis event is fired when the user stops dragging the marker.\n\n\tMapper::marker(53.381128999999990000, -1.470085000000040000, ['draggable' =\u003e true, 'eventDragEnd' =\u003e 'console.log(\"drag end\");']);\n\n### Information Window\n\nThe `informationWindow` method allows an information window to be added to to a map, with latitude, longitude, content, and optional parameters for options.\n\n\tMapper::informationWindow(53.381128999999990000, -1.470085000000040000, 'Content');\n\tMapper::informationWindow(53.381128999999990000, -1.470085000000040000, 'Content', ['open' =\u003e true, 'maxWidth'=\u003e 300, 'autoClose' =\u003e true, 'markers' =\u003e ['title' =\u003e 'Title']]);\n\tMapper::map(52.381128999999990000, 0.470085000000040000)-\u003einformationWindow(53.381128999999990000, -1.470085000000040000, 'Content', ['markers' =\u003e ['animation' =\u003e 'DROP']]);\n\n### Polyline\n\nThe `polyline` method allows a polyline to be added to a map, with coordinates, and optional parameters for options.\n\n\tMapper::polyline([['latitude' =\u003e 53.381128999999990000, 'longitude' =\u003e -1.470085000000040000], ['latitude' =\u003e 52.381128999999990000, 'longitude' =\u003e 0.470085000000040000]]);\n\tMapper::polyline([['latitude' =\u003e 53.381128999999990000, 'longitude' =\u003e -1.470085000000040000], ['latitude' =\u003e 52.381128999999990000, 'longitude' =\u003e 0.470085000000040000]], ['editable' =\u003e 'true']);\n\tMapper::map(52.381128999999990000, 0.470085000000040000)-\u003epolyline([['latitude' =\u003e 53.381128999999990000, 'longitude' =\u003e -1.470085000000040000], ['latitude' =\u003e 52.381128999999990000, 'longitude' =\u003e 0.470085000000040000]], ['strokeColor' =\u003e '#000000', 'strokeOpacity' =\u003e 0.1, 'strokeWeight' =\u003e 2]);\n\n### Polygon\n\nThe `polygon` method allows a polygon to be added to a map, with coordinates, and optional parameters for options.\n\n\tMapper::polygon([['latitude' =\u003e 53.381128999999990000, 'longitude' =\u003e -1.470085000000040000], ['latitude' =\u003e 52.381128999999990000, 'longitude' =\u003e 0.470085000000040000]]);\n\tMapper::polygon([['latitude' =\u003e 53.381128999999990000, 'longitude' =\u003e -1.470085000000040000], ['latitude' =\u003e 52.381128999999990000, 'longitude' =\u003e 0.470085000000040000]], ['editable' =\u003e 'true']);\n\tMapper::map(52.381128999999990000, 0.470085000000040000)-\u003epolygon([['latitude' =\u003e 53.381128999999990000, 'longitude' =\u003e -1.470085000000040000], ['latitude' =\u003e 52.381128999999990000, 'longitude' =\u003e 0.470085000000040000]], ['strokeColor' =\u003e '#000000', 'strokeOpacity' =\u003e 0.1, 'strokeWeight' =\u003e 2, 'fillColor' =\u003e '#FFFFFF']);\n\n### Rectangle\n\nThe `rectangle` method allows a rectangle to be added to a map, with coordinates, and optional parameters for options.\n\n\tMapper::rectangle([['latitude' =\u003e 53.381128999999990000, 'longitude' =\u003e -1.470085000000040000], ['latitude' =\u003e 52.381128999999990000, 'longitude' =\u003e 0.470085000000040000]]);\n\tMapper::rectangle([['latitude' =\u003e 53.381128999999990000, 'longitude' =\u003e -1.470085000000040000], ['latitude' =\u003e 52.381128999999990000, 'longitude' =\u003e 0.470085000000040000]], ['editable' =\u003e 'true']);\n\tMapper::map(52.381128999999990000, 0.470085000000040000)-\u003erectangle([['latitude' =\u003e 53.381128999999990000, 'longitude' =\u003e -1.470085000000040000], ['latitude' =\u003e 52.381128999999990000, 'longitude' =\u003e 0.470085000000040000]], ['strokeColor' =\u003e '#000000', 'strokeOpacity' =\u003e 0.1, 'strokeWeight' =\u003e 2, 'fillColor' =\u003e '#FFFFFF']);\n\n### Circle\n\nThe `circle` method allows a circle to be added to a map, with coordinates, and optional parameters for options.\n\n\tMapper::circle([['latitude' =\u003e 53.381128999999990000, 'longitude' =\u003e -1.470085000000040000]]);\n\tMapper::circle([['latitude' =\u003e 53.381128999999990000, 'longitude' =\u003e -1.470085000000040000]], ['editable' =\u003e 'true']);\n\tMapper::map(52.381128999999990000, 0.470085000000040000)-\u003ecircle([['latitude' =\u003e 53.381128999999990000, 'longitude' =\u003e -1.470085000000040000]], ['strokeColor' =\u003e '#000000', 'strokeOpacity' =\u003e 0.1, 'strokeWeight' =\u003e 2, 'fillColor' =\u003e '#FFFFFF', 'radius' =\u003e 1000]);\n\n### Render\n\nThe `render` method allows all maps to be rendered to the page, this method can be included in Views or added as controller passed parameter, and optional parameter for item.\n\n\tMapper::render();\n\tMapper::render(0);\n\n### RenderJavascript\n\nThe `renderJavascript` method allows all required javascript to be rendered to the page, this method can be included in Views or added as controller passed parameter.\n\n\tMapper::renderJavascript();\n\n### License\n\nGooglmapper is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbradcornford%2FGooglmapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbradcornford%2FGooglmapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbradcornford%2FGooglmapper/lists"}