2017 © Pedro Peláez
 

library yii2-google-maps-api

Easy access to Google API functions from Yii2 application

image

kossmoss/yii2-google-maps-api

Easy access to Google API functions from Yii2 application

  • Wednesday, May 3, 2017
  • by kossmoss
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1,690 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 6 Versions
  • 7 % Grown

The README.md

yii2-google-maps-api

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., (*1)

Installation

Add a dependency to your project's composer.json:, (*2)

{
    "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:, (*3)

    '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:, (*4)




<?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:, (*5)

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:, (*6)

The Versions

03/05 2017

dev-master

9999999-dev

Easy access to Google API functions from Yii2 application

  Sources   Download

MIT

The Requires

 

by Monte Ohrt
by Konstantin Petrov

03/05 2017

0.2.2

0.2.2.0

Easy access to Google API functions from Yii2 application

  Sources   Download

MIT

The Requires

 

by Monte Ohrt
by Konstantin Petrov

21/03 2016

0.2.1

0.2.1.0

Easy access to Google API functions from Yii2 application

  Sources   Download

MIT

The Requires

 

by Monte Ohrt
by Konstantin Petrov

21/03 2016

0.2

0.2.0.0

Easy access to Google API functions from Yii2 application

  Sources   Download

MIT

The Requires

 

by Monte Ohrt
by Konstantin Petrov

21/03 2016

1.0.1

1.0.1.0

Easy access to Google API functions from Yii2 application

  Sources   Download

MIT

The Requires

 

by Monte Ohrt
by Konstantin Petrov

10/02 2016

1.0

1.0.0.0

Easy access to Google API functions from Yii2 application

  Sources   Download

MIT

The Requires

 

by Monte Ohrt
by Konstantin Petrov