PHPackages                             nailfor/leaflet - 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. nailfor/leaflet

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

nailfor/leaflet
===============

LeafLet Mobile-Friendly Interactive Maps Extension Library for Laravel

1.0.8(6y ago)11.5k1BSD-3-ClausePHP

Since Jan 15Pushed 6y ago1 watchersCompare

[ Source](https://github.com/nailfor/leaflet)[ Packagist](https://packagist.org/packages/nailfor/leaflet)[ Docs](https://github.com/nailfor/leaflet)[ RSS](/packages/nailfor-leaflet/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (2)Versions (10)Used By (0)

LeafLet Extension for Laravel
=============================

[](#leaflet-extension-for-laravel)

Leaflet plugin for Laravel freamwork

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
composer require nailfor/leaflet
npm install vue2-leaflet --save

```

or add

```
"nailfor/leaflet" : "*"
```

to the require section of your application's `composer.json` file.

Usage
-----

[](#usage)

Publish js classes

```
php artisan vendor:publish --provider="nailfor\leaflet\Providers\MapServiceProvider"

```

Register components in app.js

```
import Vue2Leaflet from 'vue2-leaflet';
Vue.component('v-map', Vue2Leaflet.LMap);
Vue.component('v-tilelayer', Vue2Leaflet.LTileLayer);
Vue.component('v-marker', Vue2Leaflet.LMarker);
Vue.component('v-circle', Vue2Leaflet.LCircle);
Vue.component('v-polygon', Vue2Leaflet.LPolygon);
Vue.component('v-control', Vue2Leaflet.LControlZoom);
Vue.component('v-popup', Vue2Leaflet.LPopup);
Vue.component('v-icon', Vue2Leaflet.LIcon);

```

Example Controller

```

use nailfor\leaflet\Leaflet;
use nailfor\leaflet\Circle;
use nailfor\leaflet\Marker;
use nailfor\leaflet\Polygon;

class MapController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @param UsersGridInterface $usersGrid
     * @param Request $request
     * @return \Illuminate\Http\Response
     */
    public function index() {
        $marker = new Marker([
            'coord'     => ['55.75222', '37.61556'],
            'iconName'  => 'checkIcon',
            'icon'      => 'icon/leaf-green.png',
            'shadow'    => 'icon/leaf-shadow.png',
            'popup'     => 'Москва',
            'draggable' => true,
            'ajax'      => '/map/ajax',     //for dynamic updadate coordinates
            'ajaxDelay' => 1,               //delay call /map/ajax in seconds
        ]);

        $circle = new Circle([
            'coord'     => ['55.75222', '37.61556'],
            'radius'    => 500
            //'popup' => 'cirle',
        ]);

        $polygon = new Polygon([
            'coord'    => [
                 ['55.75222', '37.61556'],
                 ['55.75222', '37.62556'],
                 ['55.76222', '37.62556']
            ]
            //'color' => 'yellow',
            //'popup' => 'triangle',
        ]);

        $map = new Leaflet([
            'objects' => [
                $marker,
                $circle,
                $polygon,
            ]
        ]);
        return $map->render();
    }

    /**
    * route for /map/ajax
    * return random coords
    */
    public function ajax() {
        $dx = rand();
        $dy = rand();
        $x  = floatval("55.7$dx");
        $y  = floatval("37.7$dy");
        $res = [$x, $y];
        return json_encode($res);
    }
}

```

By default render() use /resources/views/map.blade.php with next content:

```
@extends('layout')

@section('content')
    {!! $map !!}
@stop

```

But you can change it, use next code:

```
        $map = new Leaflet([
            'view' => 'name_your_view',
        ]);

```

Credits
-------

[](#credits)

- [nailfor](https://github.com/nailfor)

License
-------

[](#license)

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

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity66

Established project with proven stability

 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

Every ~20 days

Recently: every ~39 days

Total

9

Last Release

2518d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1f0e23d07efd81dccb69223c1ef1897b2aa0d3eb74d7b2ee3627160406d43334?d=identicon)[nailfor](/maintainers/nailfor)

---

Top Contributors

[![nailfor](https://avatars.githubusercontent.com/u/13346879?v=4)](https://github.com/nailfor "nailfor (7 commits)")

---

Tags

laravelextensionmapsleafletnailfor

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nailfor-leaflet/health.svg)

```
[![Health](https://phpackages.com/badges/nailfor-leaflet/health.svg)](https://phpackages.com/packages/nailfor-leaflet)
```

###  Alternatives

[cornford/googlmapper

An easy way to integrate Google Maps with Laravel.

457447.9k4](/packages/cornford-googlmapper)[fahiem/filament-pinpoint

Google Maps location picker component for Filament 4 &amp; 5 with search, draggable marker, and reverse geocoding

136.5k](/packages/fahiem-filament-pinpoint)

PHPackages © 2026

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