sonkei/google-map
Yii2 implementation of google map, (*1)
, (*2)
sonkei/google-map is designed to work out of the box. It means that installation requires minimal steps. Only one configuration step should be taken and you are ready to have google map on your Yii2 website., (*3)
Installation:
1. Download
Yii2-user can be installed using composer. Run following command to download and install Yii2-user:, (*4)
composer require sonkei/google-map
Add following lines to your main configuration file (components):, (*5)
'assetManager' => [
'bundles' => [
'sonkei\gmap\GoogleAsset' => [
'options' => [
'language' => 'ru', # Preferred language
'region' => 'KG', # Preffered region
'libraries' => 'places', # Required by the plugin
'googleMapsApiKey' => '', # Your google map api key
]
]
],
],
Or setup parameters of your application (config/params.php), (*6)
return [
'gmap' => [
'language' => 'ru', # Preferred language
'region' => 'KG', # Preffered region
'libraries' => 'places', # Required by the plugin
'googleMapsApiKey' => '', # Your google map api key
],
];
Where do I go now?
You have sonkei/google-map installed. Now you can use it by:, (*7)
echo \sonkei\gmap\Widget::widget([
# Options
]);