arielmejiadev/leaflet-for-laravel 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

arielmejiadev/leaflet-for-laravel

Composer 安装命令:

composer require arielmejiadev/leaflet-for-laravel

包简介

brings an easy integration to use leaflet javascript library using Laravel with blade views

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

A fluent, expressive PHP API for rendering Leaflet.js maps in Laravel — no JavaScript required.

Full Documentation

Quick Start

1. Install

composer require arielmejiadev/leaflet-for-laravel

2. Build a map in your controller

use arielmejiadev\LeafletForLaravel\LeafletMap;
use arielmejiadev\LeafletForLaravel\Marker;

class LandmarkController extends Controller
{
    public function index()
    {
        $map = LeafletMap::of('landmarks')
            ->center(40.6892, -74.0445)
            ->zoom(15)
            ->marker(40.6892, -74.0445, fn (Marker $pin) => $pin
                ->popup('<b>Statue of Liberty</b><br>New York, NY')
                ->icon('blue')
            );

        return view('landmarks.index', compact('map'));
    }
}

3. Render in Blade

<!DOCTYPE html>
<html>
<head>
    @leafletStyles
</head>
<body>
    @leafletMap($map)
</body>
</html>

That's it — two Blade directives and you have a live, interactive map.

Features

  • Pure PHP — write maps in PHP, zero JavaScript needed
  • Fluent API — chainable methods like ->center()->zoom()->marker()
  • Markers — popups, tooltips, draggable pins, colored icons, circles
  • Glyph Icons — Font Awesome & Material Design icons rendered on pins
  • Layer Control — multiple base map styles + toggleable overlay groups
  • GeoJSON — render points, lines, and feature collections
  • Blade Directives@leafletStyles + @leafletMap($map)
  • Livewire Ready — scaffold components with php artisan make:leaflet
  • Macros & Conditionals — extend with Map::macro(), branch with ->when()
  • Multiple Maps — independent instances on the same page

Installation

composer require arielmejiadev/leaflet-for-laravel

Optionally publish the config:

php artisan vendor:publish --tag="leaflet-for-laravel-config"

Documentation

Visit the full documentation site for guides on:

  • Maps — center, zoom, dimensions, tile layers, macros
  • Markers — popups, tooltips, icons, circles, bulk markers
  • Icons — colors, custom icons, Font Awesome & Material Design glyphs
  • Layer Control — base map switching, overlay groups
  • GeoJSON — points, lines, files, APIs
  • Advanced Example — full controller with everything combined
  • Artisan Command — generate PHP or Livewire map classes

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 59
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固