{"id":17028975,"url":"https://github.com/larswiegers/laravel-maps","last_synced_at":"2025-05-15T04:04:24.903Z","repository":{"id":42961385,"uuid":"360525769","full_name":"LarsWiegers/laravel-maps","owner":"LarsWiegers","description":"Your laravel maps libary.","archived":false,"fork":false,"pushed_at":"2025-02-20T19:00:31.000Z","size":1222,"stargazers_count":272,"open_issues_count":2,"forks_count":35,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-15T04:03:58.301Z","etag":null,"topics":["googlemaps","hacktoberfest","laravel","leafletjs","map","maps","package"],"latest_commit_sha":null,"homepage":"https://github.com/LarsWiegers/laravel-maps","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/LarsWiegers.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-22T13:18:09.000Z","updated_at":"2025-05-06T21:39:14.000Z","dependencies_parsed_at":"2024-02-20T19:52:12.049Z","dependency_job_id":"f37c0ddc-2629-4ab8-b15a-580d26865237","html_url":"https://github.com/LarsWiegers/laravel-maps","commit_stats":{"total_commits":56,"total_committers":6,"mean_commits":9.333333333333334,"dds":0.125,"last_synced_commit":"62351e4600e2aaa07be3dee4e0db49836edf6ba8"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LarsWiegers%2Flaravel-maps","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LarsWiegers%2Flaravel-maps/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LarsWiegers%2Flaravel-maps/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LarsWiegers%2Flaravel-maps/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LarsWiegers","download_url":"https://codeload.github.com/LarsWiegers/laravel-maps/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254270641,"owners_count":22042858,"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":["googlemaps","hacktoberfest","laravel","leafletjs","map","maps","package"],"created_at":"2024-10-14T07:56:50.648Z","updated_at":"2025-05-15T04:04:24.826Z","avatar_url":"https://github.com/LarsWiegers.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel maps\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/larswiegers/laravel-maps.svg?style=flat-square)](https://packagist.org/packages/larswiegers/laravel-maps)\n[![Total Downloads](https://img.shields.io/packagist/dt/larswiegers/laravel-maps.svg?style=flat-square)](https://packagist.org/packages/larswiegers/laravel-maps)\n![GitHub Actions](https://github.com/larswiegers/laravel-maps/actions/workflows/main.yml/badge.svg)\n\n![Laravel maps](https://banners.beyondco.de/Laravel%20Maps.png?theme=light\u0026packageManager=composer+require\u0026packageName=larswiegers%2Flaravel-maps\u0026pattern=architect\u0026style=style_1\u0026description=The+easiest+way+to+use+maps+in+your+laravel+app.+\u0026md=1\u0026showWatermark=0\u0026fontSize=100px\u0026images=map\u0026widths=500\u0026heights=500)\n\nThis package allows you to easily use leaflet.js or google maps to create a map in your laravel project.\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require larswiegers/laravel-maps\n```\n\nIf you want to customize the map views more then you can publish the views:\n\n```bash\nphp artisan vendor:publish --provider=\"Larswiegers\\LaravelMaps\\LaravelMapsServiceProvider\"\n```\n\n## Supported map types\n| What        | Basic map | Different map types | Centerpoint | Basic markers | Use bounds | Zoomlevel | Can use different tiles | Can be used multiple times on the same page |\n| ----------- | :-------: | :-----------------: | :---------: | :-----------: | :--------: | :-------: | :---------------------: | :------------------------------------------ |\n| Leaflet     |     ✅     |          ❌          |      ✅      |       ✅       |     ❌      |     ✅     |            ✅            | ✅                                           |\n| Google maps |     ✅     |          ✅          |      ✅      |       ✅       |     ✅      |     ✅     |            ✅            | ❌                                           |\n\n#### Tilehosts\n##### Openstreetmap\nOpenstreetmap is a creative commence tile library created by volunteers.\nNo configuration has to be set to use as it is the default tilehost for this library.\nMore information can be found here: [openstreetmap.org](https://www.openstreetmap.org)\n\n##### Mapbox\nMapbox is a for profit company that also offers free keys.\nTheir map can be more accurate / precise.\nTo get your free key go to [mapbox.com](https://account.mapbox.com/auth/signup/)\nOnce logged in you can get your free key and use it by placing it in the env file like this ``MAPS_MAPBOX_ACCESS_TOKEN``.\n\n##### Attribution\nMapbox requires you to have attribution when you use their tilehost. More information on that here: https://docs.mapbox.com/help/getting-started/attribution/ \nWe provide a default value if you use mapbox. But if you want to customize it you can pass in the te text via the attribution attribute. Like this:\n```\n\u003cx-maps-leaflet \n    :attribution=\"Map data \u0026copy; \u003ca href=\"https://www.openstreetmap.org/copyright\"\u003eOpenStreetMap\u003c/a\u003e contributors, Imagery © \u003ca href=\"https://www.mapbox.com/\"\u003eMapbox\u003c/a\u003e\"\u003e\n\u003c/x-maps-leaflet\u003e\n```\n## Usage\n### Leaflet\n\n```blade\n// Leaflet\n// A basic map is as easy as using the x blade component.\n\n\u003cx-maps-leaflet\u003e\u003c/x-maps-leaflet\u003e\n\n// Set the centerpoint of the map:\n\u003cx-maps-leaflet :centerPoint=\"['lat' =\u003e 52.16, 'long' =\u003e 5]\"\u003e\u003c/x-maps-leaflet\u003e\n\n// Set a zoomlevel:\n\u003cx-maps-leaflet :zoomLevel=\"6\"\u003e\u003c/x-maps-leaflet\u003e\n\n// Set markers on the map:\n\u003cx-maps-leaflet :markers=\"[['lat' =\u003e 52.16444513293423, 'long' =\u003e 5.985622388024091]]\"\u003e\u003c/x-maps-leaflet\u003e\n```\nDo note that if you want to use multiple maps on the same page that you need to specify an id per map.\n\n#### Leaflet Version\nBy default we use the latest version of leaflet, but if you want to use a different version just pass it in via a parameter:\n```blade\n// Set leafletVersion to desired version:\n\u003cx-maps-leaflet leafletVersion='1.9.4'\u003e\u003c/x-maps-leaflet\u003e\n```\n### Google Maps\n``` blade\n// Google Maps\n\n// Set the centerpoint of the map:\n\u003cx-maps-google :centerPoint=\"['lat' =\u003e 52.16, 'long' =\u003e 5]\"\u003e\u003c/x-maps-google\u003e\n\n// Set a zoomlevel:\n\u003cx-maps-google :zoomLevel=\"6\"\u003e\u003c/x-maps-google\u003e\n\n// Set type of the map (roadmap, satellite, hybrid, terrain):\n\u003cx-maps-google :mapType=\"'hybrid'\"\u003e\u003c/x-maps-google\u003e\n\n// Set markers on the map:\n\u003cx-maps-google :markers=\"[['lat' =\u003e 52.16444513293423, 'long' =\u003e 5.985622388024091]]\"\u003e\u003c/x-maps-google\u003e\n\n// You can customize the title for each markers:\n\u003cx-maps-google :markers=\"[['lat' =\u003e 52.16444513293423, 'long' =\u003e 5.985622388024091, 'title' =\u003e 'Your Title']]\"\u003e\u003c/x-maps-google\u003e\n\n// Automatically adjust the map's view during initialization to encompass all markers:\n\u003cx-maps-google\n    :markers=\"[\n        ['lat' =\u003e 46.056946, 'long' =\u003e 14.505752],\n        ['lat' =\u003e 41.902782, 'long' =\u003e 12.496365]\n    ]\"            \n    :fitToBounds=\"true\"\n\u003e\u003c/x-maps-google\u003e\n\n// Position the map's center at the geometric midpoint of all markers:\n\u003cx-maps-google\n    :markers=\"[\n        ['lat' =\u003e 46.056946, 'long' =\u003e 14.505752],\n        ['lat' =\u003e 41.902782, 'long' =\u003e 12.496365]\n    ]\"            \n    :centerToBoundsCenter=\"true\"\n    :zoomLevel=\"7\"\n\u003e\u003c/x-maps-google\u003e\n```\n#### Google maps api key\nYou can get an api key here:\n![console.cloud.google.com](https://console.cloud.google.com/project/_/apiui/credential)\nCreate an api key and enable the Maps Javascript API in the console aswell.\nPlace the api key in the env file like this ``MAPS_GOOGLE_MAPS_ACCESS_TOKEN``\n\n### Good to know\nDouble quotes need to be escaped, i.e. add a backslash followed by double quotes (/\")\n\n### Usage in livewire\nThis library does not support livewire out of the box, but some users have found a workaround to work. \nPlease see this issue for more information: https://github.com/LarsWiegers/laravel-maps/issues/34\n\nFeel free to PR a livewire component if you have the time.\n### Testing\nTo run the tests just use the following component:\n```bash\ncomposer test\n```\n\nTesting is done through rendering the blade components and making assertions on the html outputted. \nWhile this is great for initial testing it does lack some more certainty. In the future an browser test may be needed to further make sure that the code works as intended. \n\n### Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n### Security\n\nIf you discover any security related issues, please email larswiegers@live.nl instead of using the issue tracker.\n\n## Credits\n\n-   [Lars Wiegers](https://github.com/larswiegers)\n-   [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flarswiegers%2Flaravel-maps","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flarswiegers%2Flaravel-maps","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flarswiegers%2Flaravel-maps/lists"}