kalyabin/yii2-select-google-map-location
Composer 安装命令:
composer require kalyabin/yii2-select-google-map-location
包简介
Yii2 widget to select location at map and choose map coordinates
README 文档
README
Yii2 widget to select location at map and choose map coordinates
This extension adds functionality to select the location on the Google map. The extension indicates the model and attributes, which stores the address, latitude and longitude.
When choosing a location map of switches and sets the marker to the selected location. The attributes recorded address and coordinates of the selected location.
Install
Run at your console:
php composer.phar require "kalyabin/yii2-select-google-map-location" "*"
Register Google API
First, register your Google API key as described: Google API Documentation
After this, enable at Google console:
- Google Map JavaScript API (remember API key)
- Google Places API Web Service
Usage
Declare model class which will save geographic coordinates:
class SearchLocation extends \yii\base\Model { ... public $address; public $longitude; public $latitude; ... }
Render widget:
$model = new SearchLocation(); $form = \yii\widgets\ActiveForm::begin(); ... $form->field($model, 'address')->widget(\kalyabin\maplocation\SelectMapLocationWidget::className(), [ 'attributeLatitude' => 'latitude', 'attributeLongitude' => 'longitude', 'googleMapApiKey' => '<YOUR_REGISTERED_GOOGLE_MAP_API>', ]); ... \yii\widgets\ActiveForm::end();
To use movable marker on the map describe draggable option:
$model = new SearchLocation(); $form = \yii\widgets\ActiveForm::begin(); ... $form->field($model, 'address')->widget(\kalyabin\maplocation\SelectMapLocationWidget::className(), [ 'attributeLatitude' => 'latitude', 'attributeLongitude' => 'longitude', 'googleMapApiKey' => '<YOUR_REGISTERED_GOOGLE_MAP_API>', 'draggable' => true, ]); ... \yii\widgets\ActiveForm::end();
To use custom field template use placeholder {map} for ActiveField:
$model = new SearchLocation(); $form = \yii\widgets\ActiveForm::begin(); ... $form->field($model, 'address', [ 'template' => '{label}<div class="custom-class"><div class="form-control">{input}</div>{map}</div>{error}', ])->widget(\kalyabin\maplocation\SelectMapLocationWidget::className(), [ 'attributeLatitude' => 'latitude', 'attributeLongitude' => 'longitude', 'googleMapApiKey' => '<YOUR_REGISTERED_GOOGLE_MAP_API>', ]); ... \yii\widgets\ActiveForm::end();
kalyabin/yii2-select-google-map-location 适用场景与选型建议
kalyabin/yii2-select-google-map-location 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 22.69k 次下载、GitHub Stars 达 29, 最近一次更新时间为 2015 年 10 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「framework」 「map」 「location」 「widgets」 「yii2」 「input widget」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 kalyabin/yii2-select-google-map-location 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 kalyabin/yii2-select-google-map-location 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 kalyabin/yii2-select-google-map-location 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP Framework HLEB2 is the foundation of the web application. Provides ease of development and application performance.
Maps in minutes. Powered by the Google Maps API.
Yii2 map input widget. Allows you to select geographcal coordinates via a human-friendly inteface.
The official PHP library for apiip.net that allowing customers to automate IP address validation and geolocation lookup in websites, applications and back-office system. Visit our API docs at https://apiip.net/documentation
A Symfony2 Bundle to handle geographic location of your entities
A modern, feature-rich Laravel package for managing addresses with geocoding, validation, caching, and spatial operations. Perfect for e-commerce, CRM systems, and any application requiring robust address management.
统计信息
- 总下载量: 22.69k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 29
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2015-10-02