aabosham/filament-google-maps-marker
Composer 安装命令:
composer require aabosham/filament-google-maps-marker
包简介
A Filament Field to get coordinates based on Google Maps
README 文档
README
A Filament Field to get coordinates based on Google Maps.
Fork of Filament Google Maps Picker
Installation
You can install the package via composer:
composer require aabosham/filament-google-maps-marker
You must define an environment variable GOOGLE_MAPS_API_KEY in your .env file with your Google Maps API Key
You can publish the config file with:
php artisan vendor:publish --tag="filament-google-maps-marker-config"
This is the contents of the published config file:
return [ 'google_maps_key' => env('GOOGLE_MAPS_API_KEY') ];
Optionally, you can publish the views using
php artisan vendor:publish --tag="filament-google-maps-marker-views"
Usage
On your filament resource file
use AAbosham\FilamentGoogleMapsMarker\Forms\Components\GoogleMapsMarker;
On your filament form schema
GoogleMapsMarker::make('location')
This will display a simple Google Maps field with a marker in latitude 0 and longitude 0. When you click on the map, the field value and the marker positions uptades to the new coordinates.
Enabling Google Maps controls
Use this methods to enable Google Maps controls:
zoomControl(bool) (default: false) displays de zoom controls allow the user to change it
mapTypeControl(bool) (default: false) displays the map type selection control
scaleControl(bool) (default: false) displays the map scale control
streetViewControl(bool) (default: false) displays the map StreetView control
fullScreenControl(bool) (default: false) displays the full screen control
rotateControl(bool) (default: false) displays the rotation control
searchBoxControl(bool) (default: false) displays search box control to search for locations. Will update the field value upon selection
geolocationControl(bool) (default: false) custom control to get the device geolocation and update the map position with it. It required the user to allow the device permission to access geolocation data
coordsBoxControl(bool) (default: false) custom control that shows a text input with current value of the field in the format latitude,longitude
Options
zoom(int) (default: 1) takes an integer as value and sets the initial zoom of the map
minHeight(string) (default: 50vh) accepts a string to set the map height, must be a valid CSS min-height. Ex: 80vh, 30%, 50px
mapTypeId(string) (default: roadmap) accepts a string: roadmap,satellite,hybrid, terrain
searchBoxPlaceholderText(string) (default: Search Address) accepts a string to customize de search box placeholder text
locationButtonText(string) (default: My location) accepts a string to customize de location button text
fixMarkerOnCenter(bool) (default: false) when the user drags the map the marker pans to the center and updates the field value
default(array) (default: ['lat' => 0,'lng' => 0]) sets the default value
defaultToMyLocation(bool) (default: false) sets the default value to the current location
On your filament form schema
GoogleMapsMarker::make('location') ->default(['lat' => 40.7587,'lng' => -73.9786]) ->zoom(15) ->zoomControl() ->minHeight('60vh') ->mapTypeId('satellite') ->mapTypeControl() ->scaleControl() ->streetViewControl() ->fullScreenControl() ->rotateControl() ->searchBoxControl() ->searchBoxPlaceholderText('Type an address') ->geolocationControl() ->locationButtonText('Go to my location') ->defaultToMyLocation() ->coordsBoxControl() ->fixMarkerOnCenter()
This will display a map with all the available options
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
License
The MIT License (MIT). Please see License File for more information.
aabosham/filament-google-maps-marker 适用场景与选型建议
aabosham/filament-google-maps-marker 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 760 次下载、GitHub Stars 达 1, 最近一次更新时间为 2022 年 08 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「Forms」 「google maps」 「laravel」 「location」 「field」 「coordinates」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 aabosham/filament-google-maps-marker 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 aabosham/filament-google-maps-marker 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 aabosham/filament-google-maps-marker 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Laravel Nova Google Maps Field.
ConfirmationField is a form field for Atk14 applications. It's like the BooleanField (checkbox) but the ConfirmationField must be ticked.
Field for number with restricted count of digits and decimal places
Google Maps PHP SDK.
HTML and form generation
Build forms from schema
统计信息
- 总下载量: 760
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-08-04

