codewithdennis/filament-simple-map 问题修复 & 功能扩展

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

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

codewithdennis/filament-simple-map

Composer 安装命令:

composer require codewithdennis/filament-simple-map

包简介

This package offers a straightforward and easy-to-use map action component for your Filament application.

README 文档

README

Latest Version on Packagist GitHub Code Style Action Status Total Downloads

This package provides a simple and user-friendly map display action component for your Filament application. It utilizes an iframe to render the map, ensuring seamless integration. Ensure you have a Google Maps API key to use this package.

thumbnail.png

Installation

You can install the package via composer:

composer require codewithdennis/filament-simple-map

You can publish the config file with:

php artisan vendor:publish --tag="filament-simple-map-config"

This is the contents of the published config file:

return [
    'google_maps_embed_api_key' => env('GOOGLE_MAPS_EMBED_API_KEY'),
];

Usage

This package supports the following Google Maps modes place, view, streetview, search and directions. The default mode is place. You can use it for Table Actions, Infolists, Forms, and regular actions. Just make sure you import the right component.

Place

Methods that are available with the default place mode.

Defines map marker location.

->address('City Hall, New York, NY')

Defines center of the map view.

->center('37.4218,-122.0840')

Sets initial zoom level of the map.

->zoom(10) // 0 to 21

Sets the map to satellite view. (default: roadmap)

->satellite()

Defines the language to use for UI elements and for the display of labels on map tiles.

->language('en')

Defines the appropriate borders and labels to display, based on geopolitical sensitivities.

->region('en')

Here is an example of how to use the place mode.

Forms\Components\TextInput::make('address')
    ->required()
    ->maxLength(255)
    ->suffixAction(
        SimpleMap::make('showMap')
            ->icon('heroicon-o-map')
            ->address('City Hall, New York, NY')
            ->center('37.4218,-122.0840')
            ->zoom(10)
            ->satellite()
            ->language('en')
            ->region('US'),
    ),

View

To use the view mode, you need to call the viewing method.

Sets the map to viewing mode.

->viewing()

Defines center of the map view.

->center('-33.8569,151.2152')

Sets initial zoom level of the map.

->zoom(10) // 0 to 21

Sets the map to satellite view. (default: roadmap)

->satellite()

Here is an example of how to use the view mode.

Forms\Components\TextInput::make('address')
    ->required()
    ->maxLength(255)
    ->suffixAction(
        SimpleMap::make('showMap')
            ->viewing()
            ->center('-33.8569,151.2152')
            ->zoom(10)
            ->satellite()
    ),

Directions

To use the directions mode, you need to call the directions method.

Defines the starting point for calculating directions.

->origin('Amsterdam, Netherlands')

Defines the destination point for calculating directions.

->destination('Rotterdam, Netherlands')

Specifies one or more intermediary places to route directions between the origin and destination.

->waypoints([
    'Utrecht, Netherlands',
    'Den Haag, Netherlands'
])

Specifies features to avoid in directions. Note that this doesn't preclude routes that include the restricted feature(s); it biases the result to more favorable routes.

->avoid([
    'tolls',
    'highways',
    'ferries'
])

Sets the mode of transport to flying.

->flying()

Sets the mode of transport to walking.

->walking()

Sets the mode of transport to bicycling.

->bicycling()

Sets the mode of transport to transit.

->transit()

Sets the mode of transport to driving.

->driving()

Sets the unit system to imperial. (default: metric)

->imperial()

Defines center of the map view.

->center('52.3676,4.9041')

Sets the map to satellite view. (default: roadmap)

->satellite()

Defines the language to use for UI elements and for the display of labels on map tiles.

->language('nl')

Defines the appropriate borders and labels to display, based on geopolitical sensitivities.

->region('nl')

Here is an example of how to use the directions mode.

Forms\Components\TextInput::make('address')
    ->required()
    ->maxLength(255)
    ->suffixAction(
        SimpleMap::make('showMap')
            ->directions()
            ->origin('Amsterdam, Netherlands')
            ->destination('Rotterdam, Netherlands')
            ->walking()
            ->imperial()
            ->satellite()
            ->language('nl')
    ),

Streetview

To use the streetview mode, you need to call the streetview method.

Defines the location to display street view.

->location('52.3676,4.9041')

Indicates the compass heading of the camera in degrees clockwise from North.

->heading(0) // -180 to 360

Specifies the angle, up or down, of the camera.

->pitch(0) // -90 to 90

Determines the horizontal field of view of the image.

->fov(100) // 10 to 100

Defines center of the map view.

->center('52.3676,4.9041')

Sets initial zoom level of the map.

->zoom(10) // 0 to 21

Defines the language to use for UI elements and for the display of labels on map tiles.

->language('nl')

Defines the appropriate borders and labels to display, based on geopolitical sensitivities.

->region('nl')

Search

To use the search mode, you need to call the search method.

Defines the search term.

->query('restaurants near Amsterdam, Netherlands')

Defines center of the map view.

->center('52.3676,4.9041')

Sets initial zoom level of the map.

->zoom(10) // 0 to 21

Sets the map to satellite view. (default: roadmap)

->satellite()

Defines the language to use for UI elements and for the display of labels on map tiles.

->language('nl')

Defines the appropriate borders and labels to display, based on geopolitical sensitivities.

->region('nl')

Here is an example of how to use the search mode.

Forms\Components\TextInput::make('address')
    ->required()
    ->maxLength(255)
    ->suffixAction(
       SimpleMap::make()
            ->search()
            ->query('restaurants near Amsterdam, Netherlands')
            ->center('52.3676,4.9041')
            ->zoom(10)
    ),

Contributing

Please see CONTRIBUTING for details.

Credits

License

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

codewithdennis/filament-simple-map 适用场景与选型建议

codewithdennis/filament-simple-map 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8.2k 次下载、GitHub Stars 达 36, 最近一次更新时间为 2024 年 07 月 03 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「google-maps」 「map」 「maps」 「laravel」 「filament」 「filamentphp」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 codewithdennis/filament-simple-map 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 codewithdennis/filament-simple-map 我们能提供哪些服务?
定制开发 / 二次开发

基于 codewithdennis/filament-simple-map 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 36
  • Watchers: 1
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-07-03