PHPackages                             larswiegers/laravel-maps - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. larswiegers/laravel-maps

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

larswiegers/laravel-maps
========================

A new way to handle maps in your laravel applications.

v0.20(3mo ago)361119.1k↓23.4%41[1 PRs](https://github.com/LarsWiegers/laravel-maps/pulls)2MITPHPPHP ^8.1|^8.2CI passing

Since Apr 26Pushed 3mo ago6 watchersCompare

[ Source](https://github.com/LarsWiegers/laravel-maps)[ Packagist](https://packagist.org/packages/larswiegers/laravel-maps)[ Docs](https://github.com/larswiegers/laravel-maps)[ RSS](/packages/larswiegers-laravel-maps/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (40)Used By (2)

Laravel maps
============

[](#laravel-maps)

[![Latest Version on Packagist](https://camo.githubusercontent.com/ec2f6f1e8c1fb33a204b26ca669a1bd87c4ad1ac3a96037bb48f900a5ab29ed0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c617273776965676572732f6c61726176656c2d6d6170732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/larswiegers/laravel-maps)[![Total Downloads](https://camo.githubusercontent.com/bf8a68787a62fa59abba0e9c3887b916c3bb7869a1e1d1a66b39774bda003a99/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c617273776965676572732f6c61726176656c2d6d6170732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/larswiegers/laravel-maps)[![GitHub Actions](https://github.com/larswiegers/laravel-maps/actions/workflows/main.yml/badge.svg)](https://github.com/larswiegers/laravel-maps/actions/workflows/main.yml/badge.svg)

[![Laravel maps](https://camo.githubusercontent.com/c40e697b4a9dd430d47a13bedd359198c9136bd9b7eb7dd150dec716dc391851/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4c61726176656c2532304d6170732e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d6c617273776965676572732532466c61726176656c2d6d617073267061747465726e3d617263686974656374267374796c653d7374796c655f31266465736372697074696f6e3d5468652b656173696573742b7761792b746f2b7573652b6d6170732b696e2b796f75722b6c61726176656c2b6170702e2b266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d313030707826696d616765733d6d6170267769647468733d35303026686569676874733d353030)](https://camo.githubusercontent.com/c40e697b4a9dd430d47a13bedd359198c9136bd9b7eb7dd150dec716dc391851/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4c61726176656c2532304d6170732e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d6c617273776965676572732532466c61726176656c2d6d617073267061747465726e3d617263686974656374267374796c653d7374796c655f31266465736372697074696f6e3d5468652b656173696573742b7761792b746f2b7573652b6d6170732b696e2b796f75722b6c61726176656c2b6170702e2b266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d313030707826696d616765733d6d6170267769647468733d35303026686569676874733d353030)

This package allows you to easily use leaflet.js or google maps to create a map in your laravel project.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require larswiegers/laravel-maps
```

If you want to customize the map views more then you can publish the views:

```
php artisan vendor:publish --provider="Larswiegers\LaravelMaps\LaravelMapsServiceProvider"
```

Supported map types
-------------------

[](#supported-map-types)

WhatBasic mapDifferent map typesCenterpointBasic markersUse boundsZoomlevelCan use different tilesCan be used multiple times on the same pageLeaflet✅❌✅✅❌✅✅✅Google maps✅✅✅✅✅✅✅❌#### Tilehosts

[](#tilehosts)

##### Openstreetmap

[](#openstreetmap)

Openstreetmap is a creative commence tile library created by volunteers. No configuration has to be set to use as it is the default tilehost for this library. More information can be found here: [openstreetmap.org](https://www.openstreetmap.org)

##### Mapbox

[](#mapbox)

Mapbox is a for profit company that also offers free keys. Their map can be more accurate / precise. To get your free key go to [mapbox.com](https://account.mapbox.com/auth/signup/)Once logged in you can get your free key and use it by placing it in the env file like this `MAPS_MAPBOX_ACCESS_TOKEN`.

##### Attribution

[](#attribution)

Mapbox requires you to have attribution when you use their tilehost. More information on that here: We 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:

```

```

Usage
-----

[](#usage)

### Leaflet

[](#leaflet)

```
// Leaflet
// A basic map is as easy as using the x blade component.

// Set the centerpoint of the map:

// Set a zoomlevel:

// Set markers on the map:

```

Do note that if you want to use multiple maps on the same page that you need to specify an id per map.

#### Leaflet Version

[](#leaflet-version)

By default we use the latest version of leaflet, but if you want to use a different version just pass it in via a parameter:

```
// Set leafletVersion to desired version:

```

### Google Maps

[](#google-maps)

```
// Google Maps

// Set the centerpoint of the map:

// Set a zoomlevel:

// Set type of the map (roadmap, satellite, hybrid, terrain):

// Set markers on the map:

// You can customize the title for each markers:

// You can add custom icons to markers:

// You can add text labels next to markers (uses Advanced Markers):

// You can combine icons and labels:

// You can add info windows that appear when clicking markers:

// Automatically adjust the map's view during initialization to encompass all markers:

// Position the map's center at the geometric midpoint of all markers:

```

#### Google maps api key

[](#google-maps-api-key)

You can get an api key here: [![console.cloud.google.com](https://camo.githubusercontent.com/9ce71cd6daa9c358376c402717aa2b107e7d6ea41ff92373118b21bdfa97af1c/68747470733a2f2f636f6e736f6c652e636c6f75642e676f6f676c652e636f6d2f70726f6a6563742f5f2f61706975692f63726564656e7469616c)](https://camo.githubusercontent.com/9ce71cd6daa9c358376c402717aa2b107e7d6ea41ff92373118b21bdfa97af1c/68747470733a2f2f636f6e736f6c652e636c6f75642e676f6f676c652e636f6d2f70726f6a6563742f5f2f61706975692f63726564656e7469616c)Create an api key and enable the Maps Javascript API in the console aswell. Place the api key in the env file like this `MAPS_GOOGLE_MAPS_ACCESS_TOKEN`

#### Advanced Markers

[](#advanced-markers)

This package now uses Google Maps' AdvancedMarkerElement (introduced in v3.56) instead of the deprecated google.maps.Marker class. Advanced Markers provide several improvements including:

- Better performance and rendering
- Support for custom HTML content including text labels next to markers
- Improved accessibility
- Future-proof implementation aligned with Google's latest recommendations

Read more about Advanced Markers: [Google Maps Advanced Markers Documentation](https://developers.google.com/maps/documentation/javascript/advanced-markers/overview)

### Good to know

[](#good-to-know)

Double quotes need to be escaped, i.e. add a backslash followed by double quotes (/")

### Usage in livewire

[](#usage-in-livewire)

This library does not support livewire out of the box, but some users have found a workaround to work. Please see this issue for more information: [\#34](https://github.com/LarsWiegers/laravel-maps/issues/34)

Feel free to PR a livewire component if you have the time.

### Testing

[](#testing)

To run the tests just use the following component:

```
composer test
```

Testing is done through rendering the blade components and making assertions on the html outputted. While 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.

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Lars Wiegers](https://github.com/larswiegers)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

60

—

FairBetter than 99% of packages

Maintenance81

Actively maintained with recent releases

Popularity54

Moderate usage in the ecosystem

Community26

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 87.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~90 days

Recently: every ~232 days

Total

20

Last Release

100d ago

PHP version history (3 changes)v0.1PHP ^7.4|^8.0

v0.13PHP ^7.4|^8.0|^8.1|^8.2

v0.14PHP ^8.1|^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/9905a3f80dd1dfb7b5e6d8930ba7fa6986738ff0575ad6f7aa3bc3937512af1f?d=identicon)[LarsWiegers](/maintainers/LarsWiegers)

---

Top Contributors

[![LarsWiegers](https://avatars.githubusercontent.com/u/20204608?v=4)](https://github.com/LarsWiegers "LarsWiegers (58 commits)")[![ryangurn](https://avatars.githubusercontent.com/u/1297082?v=4)](https://github.com/ryangurn "ryangurn (3 commits)")[![kikojover](https://avatars.githubusercontent.com/u/7113313?v=4)](https://github.com/kikojover "kikojover (1 commits)")[![kopitar](https://avatars.githubusercontent.com/u/19343414?v=4)](https://github.com/kopitar "kopitar (1 commits)")[![fgaroby](https://avatars.githubusercontent.com/u/498286?v=4)](https://github.com/fgaroby "fgaroby (1 commits)")[![mohamedsabil83](https://avatars.githubusercontent.com/u/10126040?v=4)](https://github.com/mohamedsabil83 "mohamedsabil83 (1 commits)")[![Xammie](https://avatars.githubusercontent.com/u/13081809?v=4)](https://github.com/Xammie "Xammie (1 commits)")

---

Tags

googlemapshacktoberfestlaravelleafletjsmapmapspackagelarswiegerslaravel-maps

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/larswiegers-laravel-maps/health.svg)

```
[![Health](https://phpackages.com/badges/larswiegers-laravel-maps/health.svg)](https://phpackages.com/packages/larswiegers-laravel-maps)
```

###  Alternatives

[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)[erlandmuchasaj/laravel-gzip

Gzip your responses.

40129.3k2](/packages/erlandmuchasaj-laravel-gzip)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
