PHPackages                             lbcdev/livewire-maps-core - 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. lbcdev/livewire-maps-core

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

lbcdev/livewire-maps-core
=========================

A Livewire component for interactive maps using Leaflet

v1.0.0(3mo ago)022MITPHPPHP ^8.2|^8.3CI failing

Since Feb 16Pushed 3mo agoCompare

[ Source](https://github.com/Luinux81/livewire-maps-core)[ Packagist](https://packagist.org/packages/lbcdev/livewire-maps-core)[ RSS](/packages/lbcdev-livewire-maps-core/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (6)Versions (3)Used By (2)

Livewire Maps Core
==================

[](#livewire-maps-core)

[![Tests](https://github.com/Luinux81/livewire-maps-core/workflows/Tests/badge.svg)](https://github.com/Luinux81/livewire-maps-core/actions)[![Latest Stable Version](https://camo.githubusercontent.com/ea3089110f8a009fba75891c08fc94df36b9713e26c8b2f15b8e75958e62fbe0/68747470733a2f2f706f7365722e707567782e6f72672f6c62636465762f6c697665776972652d6d6170732d636f72652f76)](https://packagist.org/packages/lbcdev/livewire-maps-core)[![Total Downloads](https://camo.githubusercontent.com/44283bd7ce795dec22fdf054ece4f843880f04718c67b7b94c371aa7116b0826/68747470733a2f2f706f7365722e707567782e6f72672f6c62636465762f6c697665776972652d6d6170732d636f72652f646f776e6c6f616473)](https://packagist.org/packages/lbcdev/livewire-maps-core)[![License](https://camo.githubusercontent.com/a57c5721dcdd26cda08e1cff7e778abc71abb3e7ff49bf2535826d56d5b709a1/68747470733a2f2f706f7365722e707567782e6f72672f6c62636465762f6c697665776972652d6d6170732d636f72652f6c6963656e7365)](https://packagist.org/packages/lbcdev/livewire-maps-core)

A Livewire component for interactive maps with Leaflet.js integration. Core package for the LBCDev Maps Suite.

Features
--------

[](#features)

- 🗺️ **Interactive Maps**: Full Leaflet.js integration via Alpine.js
- 🎯 **Single &amp; Multi Marker**: Support for single markers or marker collections
- 🔄 **Reactive Updates**: Real-time map updates with Livewire
- 📍 **Coordinate Validation**: Built-in validation for latitude/longitude
- ⚡ **Events System**: Emit and listen to map events
- 🎨 **Customizable**: Extensive configuration options
- ✅ **Well Tested**: 13 comprehensive tests
- 📚 **Fully Documented**: Complete API documentation

Requirements
------------

[](#requirements)

- PHP 8.1 or higher
- Laravel 10.x or 11.x
- Livewire 3.x
- [lbcdev/map-geometries](https://github.com/Luinux81/map-geometries)

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

[](#installation)

```
composer require lbcdev/livewire-maps-core
```

Publish the configuration file:

```
php artisan vendor:publish --tag="livewire-maps-config"
```

Quick Start
-----------

[](#quick-start)

### Basic Usage

[](#basic-usage)

```
@livewire('livewire-map', [
    'center' => ['lat' => 40.7128, 'lng' => -74.0060],
    'zoom' => 13
])
```

### With Single Marker

[](#with-single-marker)

```
use LBCDev\MapGeometries\Marker;

$marker = Marker::make(40.7128, -74.0060, 'New York City')
    ->tooltip('The Big Apple')
    ->iconColor('blue');
```

```
@livewire('livewire-map', [
    'marker' => $marker,
    'center' => ['lat' => 40.7128, 'lng' => -74.0060],
    'zoom' => 13
])
```

### With Multiple Markers

[](#with-multiple-markers)

```
use LBCDev\MapGeometries\Marker;
use LBCDev\MapGeometries\MarkerCollection;

$markers = new MarkerCollection();

$markers->add(
    Marker::make(40.7128, -74.0060, 'New York')
        ->iconColor('blue')
);

$markers->add(
    Marker::make(51.5074, -0.1278, 'London')
        ->iconColor('red')
);
```

```
@livewire('livewire-map', [
    'markers' => $markers,
    'center' => ['lat' => 40.7128, 'lng' => -74.0060],
    'zoom' => 3
])
```

Configuration
-------------

[](#configuration)

The package comes with sensible defaults, but you can customize everything:

```
// config/livewire-maps.php

return [
    'default_center' => [
        'lat' => env('LIVEWIRE_MAPS_DEFAULT_LAT', 0),
        'lng' => env('LIVEWIRE_MAPS_DEFAULT_LNG', 0),
    ],

    'default_zoom' => env('LIVEWIRE_MAPS_DEFAULT_ZOOM', 10),

    'tile_layer' => [
        'url' => 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
        'attribution' => '&copy; OpenStreetMap contributors',
    ],

    'default_options' => [
        'scrollWheelZoom' => true,
        'dragging' => true,
        'zoomControl' => true,
    ],
];
```

Component API
-------------

[](#component-api)

### Properties

[](#properties)

PropertyTypeDefaultDescription`$marker``Marker|null``null`Single marker to display`$markers``MarkerCollection|null``null`Collection of markers`$center``array`configMap center `['lat' => X, 'lng' => Y]``$zoom``int`configInitial zoom level`$height``string``'500px'`Map container height`$interactive``bool``true`Enable/disable interactions`$options``array`configLeaflet map options### Methods

[](#methods)

MethodParametersDescription`addMarker()``Marker $marker`Add a marker to the map`removeMarker()``string $id`Remove a marker by ID`clearMarkers()`-Remove all markers`flyTo()``float $lat, float $lng, int $zoom`Center map with animation### Computed Properties

[](#computed-properties)

PropertyTypeDescription`markersData``array`Get all markers as array`hasCoordinates``bool`Check if valid coordinates### Events

[](#events)

#### Emitted Events

[](#emitted-events)

```
// Coordinates updated
$this->dispatch('map-coordinates-updated', [
    'lat' => 40.7128,
    'lng' => -74.0060
]);
```

#### Listening to Events

[](#listening-to-events)

```
protected $listeners = [
    'fly-to-coordinates' => 'flyTo',
];

public function flyTo(array $data)
{
    // $data = ['lat' => X, 'lng' => Y, 'zoom' => Z]
}
```

Advanced Usage
--------------

[](#advanced-usage)

### Custom Map Options

[](#custom-map-options)

```
@livewire('livewire-map', [
    'center' => ['lat' => 40.7128, 'lng' => -74.0060],
    'zoom' => 13,
    'options' => [
        'scrollWheelZoom' => false,
        'minZoom' => 10,
        'maxZoom' => 18,
        'maxBounds' => [
            [40.5, -74.5],
            [40.9, -73.5]
        ],
    ]
])
```

### Read-Only Mode

[](#read-only-mode)

```
@livewire('livewire-map', [
    'marker' => $marker,
    'interactive' => false
])
```

### Custom Height

[](#custom-height)

```
@livewire('livewire-map', [
    'center' => ['lat' => 40.7128, 'lng' => -74.0060],
    'height' => '700px'
])
```

### Legacy Mode (Separate lat/lng)

[](#legacy-mode-separate-latlng)

For backward compatibility:

```
@livewire('livewire-map', [
    'latitude' => 40.7128,
    'longitude' => -74.0060
])
```

Using in Livewire Components
----------------------------

[](#using-in-livewire-components)

```
use Livewire\Component;
use LBCDev\MapGeometries\Marker;
use LBCDev\MapGeometries\MarkerCollection;

class LocationPicker extends Component
{
    public ?Marker $selectedLocation = null;
    public MarkerCollection $locations;

    protected $listeners = [
        'map-coordinates-updated' => 'handleLocationSelected'
    ];

    public function mount()
    {
        $this->locations = new MarkerCollection();

        // Add some locations
        $this->locations->add(
            Marker::make(40.7128, -74.0060, 'New York')
        );
    }

    public function handleLocationSelected($data)
    {
        $this->selectedLocation = Marker::make(
            $data['lat'],
            $data['lng'],
            'Selected Location'
        );
    }

    public function render()
    {
        return view('livewire.location-picker');
    }
}
```

Testing
-------

[](#testing)

```
composer test
```

With coverage:

```
composer test-coverage
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on 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)

- [Luinux81](https://github.com/Luinux81)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

Related Packages
----------------

[](#related-packages)

This package is part of the LBCDev Maps Suite:

- [map-geometries](https://github.com/Luinux81/map-geometries) - Map geometry classes (Marker, Polyline, etc.)
- [filament-maps-fields](https://github.com/Luinux81/filament-maps-fields) - Map form fields for Filament
- [filament-maps-widgets](https://github.com/Luinux81/filament-maps-widgets) - Map widgets for Filament panels
- [lbcdev-filament-maps-suite](https://github.com/Luinux81/lbcdev-filament-maps-suite) - Meta-package for all components

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance82

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

91d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/123c45b9a8f1e49e5a68964dee6ba594b89a0529ed3645136381aa2f6d65c5eb?d=identicon)[luinux81](/maintainers/luinux81)

---

Top Contributors

[![Luinux81](https://avatars.githubusercontent.com/u/8471444?v=4)](https://github.com/Luinux81 "Luinux81 (20 commits)")

---

Tags

laravelmaplivewirecomponentleaflet

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/lbcdev-livewire-maps-core/health.svg)

```
[![Health](https://phpackages.com/badges/lbcdev-livewire-maps-core/health.svg)](https://phpackages.com/packages/lbcdev-livewire-maps-core)
```

###  Alternatives

[livewire/flux

The official UI component library for Livewire.

9475.0M86](/packages/livewire-flux)[mediconesystems/livewire-datatables

Advanced datatables using Laravel, Livewire, Tailwind CSS and Alpine JS

1.2k711.3k8](/packages/mediconesystems-livewire-datatables)[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4205.3M84](/packages/livewire-volt)[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)[bezhansalleh/filament-google-analytics

Google Analytics integration for FilamentPHP

205144.8k5](/packages/bezhansalleh-filament-google-analytics)[mischasigtermans/laravel-altitude

Claude Code agents for the TALL stack, powered by Laravel Boost

1139.2k](/packages/mischasigtermans-laravel-altitude)

PHPackages © 2026

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