承接 kossmoss/yii2-google-maps-api 相关项目开发

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

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

kossmoss/yii2-google-maps-api

Composer 安装命令:

composer require kossmoss/yii2-google-maps-api

包简介

Easy access to Google API functions from Yii2 application

README 文档

README

The main purpose of this extension is finding coordinates by address from Google Maps API right from Yii2 application. It also providing asset to use Google API Javascript library in your views.

Installation

Add a dependency to your project's composer.json:

{
	"require": {
		"kossmoss/yii2-google-maps-api": "^0.2"
	}
}

Usage

This extension allows to Google Maps API JavaScript library in your views. GoogleMapsAsset will attach library to view only if you have properly configured asset params:

	'components' => [
		...
		'assetManager' => [
			'bundles' => [
				'kossmoss\GoogleMaps\GoogleMapsAsset' => [
					'apiKey' => 'YOUR_API_KEY_HERE',   // get at https://developers.google.com/maps/documentation/javascript/get-api-key
					'language' => 'ru', // use language code supported by Google Maps API  (default: en)
				],
			],
		],
		...
	],

Then register asset in your view and you'll be able to use Google Maps API JS library:

<?php
/* @var $this yii\web\View */
\kossmoss\GoogleMaps\GoogleMapsAsset::register($this);
?>
<div id="map" style="width: 400px; height: 300px;"></div>

<?php
	$this->registerJs('
		var map;
		initMap();
		
		function initMap() {
			map = new google.maps.Map(document.getElementById("map"), {
				center: {lat: -34.397, lng: 150.644},
				zoom: 8
			});
		}
	');

This extension also includes php-google-map-api library from https://github.com/streetlogics/php-google-map-api Many years have gone since it was build and for a moment it has many things to refactor, but for now maybe you find useful it's synchronous calls to Google MAP API like this:

use kossmoss\GoogleMaps\GoogleMaps;

...

$coords = GoogleMaps::coordsByAddress("Lisboa, Portugal");

If you want to use other features from original extension, you need to use GoogleMapAPI class instead of GoogleMaps class. Here you can find some documentation for GoogleMapsAPI class:

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-02-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固