rootlocal/yii2-yandexmaps

Yii2 Yandex Maps API

Installs: 10

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 3

Forks: 0

Open Issues: 2

Type:yii2-extension

v1.0.2 2020-07-22 16:03 UTC

README

Latest Stable Version

Install

composer require rootlocal/yii2-yandexmaps

or add

"rootlocal/yii2-yandexmaps": "~1.0",

to the require section of your composer.json.

Example usage config 1:

config:

<?php

return [
    
    // ...
    
    'components' => [
        
        // ...
    
        'assetManager' => [
            
            'bundles' => [
                \rootlocal\widgets\yandexmaps\ApiYandexMapAsset::class => [
                    'version' => '2.1',
                    'language' => 'ru-RU',
                    'apiKey' => 'MY_API_KEY'
                ],
            ],
            
            // ...
        ],
        
        // ...
    ]
];

view:

<?php

use yii\web\View;
use rootlocal\widgets\yandexmaps\YandexMapWidget;

/** @var View $this */
?>

<?= YandexMapWidget::widget([
        'content' => $this->render('yamapscontent'),
        'htmlOptions' => ['class' => 'yamap'],
        'options' => [
            'center' => [xx.xx, yy.yy],
            'zoom' => 16,
            'controls' => ['zoomControl'],
            'placemarks' => [
                [
                    'position' => [xx.xx, yy.yy],
                    'content' => [
                        'hintContent' => 'test',
                        'balloonContentHeader' => 'test',
                        'balloonContentBody' => 'test',
                        'balloonContentFooter' => 'test',
                    ],
                ],
            ],
        ]
    ]) ?>

Example usage config 2:

<?php

use yii\web\View;
use rootlocal\widgets\yandexmaps\YandexMapWidget;

/** @var View $this */
?>

<?= YandexMapWidget::widget([
        'apiKey' => 'MY_API_KEY',
        'language' => 'ru-RU',
        'content' => $this->render('yamapscontent'),
        'htmlOptions' => ['class' => 'yamap'],
        'options' => [
            'center' => [xx.xx, yy.yy],
            'zoom' => 16,
            'controls' => ['zoomControl'],
            'placemarks' => [
                [
                    'position' => [xx.xx, yy.yy],
                    'content' => [
                        'hintContent' => 'test',
                        'balloonContentHeader' => 'test',
                        'balloonContentBody' => 'test',
                        'balloonContentFooter' => 'test',
                    ],
                ],
            ],
        ]
    ]) ?>