loveduckie/silverstripe-google-maps-field
Composer 安装命令:
composer require loveduckie/silverstripe-google-maps-field
包简介
A SilverStripe module for integrating Google Maps Places API as part of the CMS.
README 文档
README
A Silverstripe module that provides an input field extension for collecting postal addresses using Google Maps' Autocomplete functionality from the Places API. This extension offers users a streamlined way to enter accurate addresses by suggesting address completions directly within the input field.
Features
- Autocomplete: As users type, Google Maps Autocomplete provides address suggestions.
- Field Customization: Easily integrates with Silverstripe’s form fields and can be customized to fit specific field requirements.
- Real-time Address Validation: Ensures that addresses are valid and formatted properly based on Google Maps data.
Requirements
- Silverstripe CMS 4.x or later
- Google Maps API Key (with Places API enabled)
Installation
-
Install via Composer:
composer require loveduckie/silverstripe-google-maps-field
-
Google Maps API Key: Obtain an API key from the Google Cloud Console. Ensure that the Places API is enabled.
-
Configuration: In your Silverstripe project, add the Google Maps API key to your
.envfile:GOOGLE_MAPS_API_KEY="YOUR_API_KEY" -
Build the Project: Run
dev/buildto ensure the module is loaded properly.
Usage
-
Add Field to Form: In your form class, add the address autocomplete field as shown below:
use LoveDuckie\SilverStripe\GoogleMapsField; $form->addField( GoogleMapsAutocompleteAddressField::create('Address', 'Postal Address') );
-
Customize Field Options:
- You can specify additional options like the country filter, address type, and more by configuring the field in the Silverstripe backend or by setting options directly in the form.
-
Styling: Customize the look and feel of the autocomplete field with CSS to match your site’s design.
Configuration Options
Configure the following settings in your YAML configuration file:
LoveDuckie\SilverStripe\GoogleMapsField: default_country: "US" # Set the default country for address suggestions address_components: # Specify which address components to retrieve - street_number - route - locality - administrative_area_level_1 - country - postal_code
Screenshots
TBD
Troubleshooting
- Ensure that the Google Maps API key has the correct permissions for the Places API.
- Verify that your Silverstripe cache is cleared after installation.
License
This project is licensed under the MIT License. See the LICENSE file for more details.
Contributions
Contributions are welcome! Please submit issues or pull requests to help improve this module.
Acknowledgments
This module utilizes the Google Maps API to deliver accurate address suggestions and facilitate seamless form input.
loveduckie/silverstripe-google-maps-field 适用场景与选型建议
loveduckie/silverstripe-google-maps-field 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 11 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「google-maps」 「silverstripe」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 loveduckie/silverstripe-google-maps-field 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 loveduckie/silverstripe-google-maps-field 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 loveduckie/silverstripe-google-maps-field 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Maps in minutes. Powered by the Google Maps API.
Harness the power of the Google Autocomplete API inside Craft. Adds an autocomplete search box to Craft entries.
Laravel package that helps to use GoogleMaps
Analytics chooser extensions for site settings.
Extension google maps for 2amigos google map for yii2
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2024-11-28