承接 mauricewijnia/nova-maps-address 相关项目开发

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

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

mauricewijnia/nova-maps-address

Composer 安装命令:

composer require mauricewijnia/nova-maps-address

包简介

A Laravel Nova Google Maps Field.

README 文档

README

Nova Maps Address is a Nova field that allows the user to select an adress using the Google Places API and store it in a JSON column.

Table of Contents

  1. Installation
  2. Usage

Installation

To install the field simply run:

composer require mauricewijnia/nova-maps-address

You will need a Google Maps API key with access to the Maps, Places and Geocoding API. You can place the key in your .env file like this:

NOVA_MAPS_ADDRESS_KEY="your_key_here"

Usage

This fields stores its data as JSON in your column, so we will have to cast our column to an array.

To add the field to your resource you can do:

use Mauricewijnia\NovaMapsAddress\MapsAddress;
...
public function fields(Request $request) {
    return [
        ...
        MapsAddress::make(__('Address'), 'address'),
        ...
    ];
}

And in our model:

protected $casts = [
    'address' => 'array'
]

The resulting data will have this format:

{
    street_name: string,
    street_number: string,
    postal_code: string,
    city: string,
    country: string,
    formatted_address: string,
    latitude: float,
    longitude: float
    address_components: array // https://developers.google.com/maps/documentation/javascript/geocoding#GeocodingAddressTypes
}

Options

You can change some of the settings for the map by call the respective option method:

MapsAddress::make(__('Address'), 'address')
    ->zoom(5)
    ->center(['lat' => 55.5, 'lng' => 5.5])
    ->types(['address' ,'establishment']);

You can also pass parameters to Map js request and all options available for map/autocomplete/geocoder class. For example to specify a language and regions and filter the components:

MapsAddress::make(__('shop_admin.places.address'), 'address')->types([])
                    ->scriptUrlParams(['region' => 'jp', 'language' => 'ja'])
                    ->autoCompleteOptions(['componentRestrictions' => ['country' => ['jp']]])
                    ->mapOptions(['componentRestrictions' => ['country' => ['jp']]])
Option Description Default
zoom Set the default zoom level of the map 10
center Set the initial centering point of the map ['lat' => 52.370216, 'lng' => 4.895168]
types Set the type of places that should be shown options are: establishment, address, geocode ['address']
allowMapClick Allow user to click on the map to get the address true
autoCompleteOptions Set options for AutoComplete class initialization. https://developers.google.com/maps/documentation/javascript/reference/places-widget#Autocomplete N/A
geocodeOptions Set options for Geocoder class initialization. https://developers.google.com/maps/documentation/javascript/reference/geocoder#GeocoderRequest N/A
mapOptions Set options for Map class initialization. https://developers.google.com/maps/documentation/javascript/reference/map#MapOptions N/A
scriptUrlParams Set parameters during the request of Google Map API js. https://developers.google.com/maps/documentation/javascript/url-params N/A

mauricewijnia/nova-maps-address 适用场景与选型建议

mauricewijnia/nova-maps-address 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 44.73k 次下载、GitHub Stars 达 6, 最近一次更新时间为 2020 年 09 月 10 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 mauricewijnia/nova-maps-address 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 6
  • Watchers: 1
  • Forks: 3
  • 开发语言: JavaScript

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-09-10