nailfor/leaflet
Larablocks Analysis
nailfor/leaflet works with Laravel 5 (latest release 1.0.8, Jun 26, 2019), which reached end of life: no more fixes, even for security.
Recommendation checks
Not advisedNot advised: no release or commit in over 2 years.
- No release or commit in over 2 years
- Supports only Laravel 5, past end of life
- No release in the last 12 months (last: Jun 26, 2019)
- 2 downloads a month (needs 10,000)
- 1 GitHub star (needs 100)
State
Likely abandoned- No release or commit in over 2 years.
- Last stable release: Jun 26, 2019.
- No releases in the last 12 months.
- First released: Jan 15, 2019.
- Monthly downloads: 2.
- 0 open issues on GitHub.
Data from Packagist and GitHub, checked by Larablocks on Nov 27, 2026.
| Install | |
|---|---|
composer require nailfor/leaflet |
|
| Latest Version: | 1.0.8 |
| Laravel: | 5 |
| License: | BSD-3-Clause |
| Last Updated: | Jun 26, 2019 |
| Links: | GitHub · Packagist |
LeafLet Extension for Laravel
Leaflet plugin for Laravel freamwork
Installation
The preferred way to install this extension is through composer.
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
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
License
The BSD License (BSD). Please see License File for more information.
Related Packages
SEO for Laravel - Generate pages from templates created using data variables to...
The VigLink extension for phpBB makes it possible to earn revenue, without any c...
Version History
| Version | Released | Laravel | License |
|---|---|---|---|
| 1.0.8 | ~5.5 | BSD-3-Clause | |
| 1.0.7 | ~5.5 | BSD-3-Clause | |
| 1.0.6 | ~5.5 | BSD-3-Clause | |
| 1.0.5 | ~5.5 | BSD-3-Clause | |
| 1.0.4 | ~5.5 | BSD-3-Clause | |
| 1.0.3 | ~5.5 | BSD-3-Clause | |
| 1.0.2 | ~5.5 | BSD-3-Clause | |
| 1.0.1 | ~5.5 | BSD-3-Clause | |
| 1.0.0 | ~5.5 | BSD-3-Clause |