承接 ghanem/google-map 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

ghanem/google-map

Composer 安装命令:

composer require ghanem/google-map

包简介

Google Map with Places Autocomplete field for Laravel Nova 4 & 5.

README 文档

README

Latest Stable Version License Total Downloads

Nova Google Map with Autocomplete

A Laravel Nova field that provides an interactive Google Map with Places Autocomplete for picking locations. Users can search for addresses, drag a marker, or enter coordinates manually.

Screenshot

Requirements

  • PHP 8.1+
  • Laravel Nova 4.x or 5.x
  • A Google Cloud API key with Maps JavaScript API and Places API enabled

Installation

composer require ghanem/google-map

Publish the config file:

php artisan vendor:publish --provider="Ghanem\GoogleMap\FieldServiceProvider"

Configuration

Add your Google Maps API key to .env:

GMAPS_API_KEY=your-api-key-here

Optional environment variables with their defaults:

GMAPS_DEFAULT_LATITUDE=41.657523
GMAPS_DEFAULT_LONGITUDE=-101.157292
GMAPS_DEFAULT_ZOOM=3

Get your API key from the Google Cloud Console. Make sure to enable both Maps JavaScript API and Places API.

Usage

Add the field to your Nova resource:

use Ghanem\GoogleMap\GHMap;

public function fields(NovaRequest $request): array
{
    return [
        // ...
        GHMap::make('Location'),
    ];
}

Your model needs latitude and longitude columns (or custom names — see below).

Custom Field Names

If your database columns are not named latitude and longitude:

GHMap::make('Location')
    ->latitude('lat')
    ->longitude('lng'),

Hide Coordinate Inputs

GHMap::make('Location')
    ->hideLatitude()
    ->hideLongitude(),

Custom Zoom Level

GHMap::make('Location')
    ->zoom(10),

Override API Key Per Field

GHMap::make('Location')
    ->apiKey('different-api-key'),

All Options Combined

GHMap::make('Location')
    ->latitude('lat')
    ->longitude('lng')
    ->zoom(12)
    ->hideLatitude()
    ->hideLongitude(),

You can also use any standard Nova field methods (validation, visibility, etc.):

GHMap::make('Location')
    ->rules('required')
    ->hideFromIndex(),

Events

When a location is selected (via autocomplete or marker drag), the field emits Nova events that you can listen to in other custom fields:

Event Description
address-update Full formatted address
city-update City / locality name
state-update State / administrative area
country-update Country name
zip-code-update Postal code
latitude-update Latitude value (incoming)
longitude-update Longitude value (incoming)

Changelog

See CHANGELOG.md for release history.

License

MIT - see LICENSE for details.

Sponsor

Become a Sponsor

ghanem/google-map 适用场景与选型建议

ghanem/google-map 是一款 基于 Vue 开发的 Composer 扩展包,目前已累计 106.42k 次下载、GitHub Stars 达 8, 最近一次更新时间为 2022 年 10 月 06 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 8
  • Watchers: 1
  • Forks: 0
  • 开发语言: Vue

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-10-06