kl83/yii2-ymaps Yii2 Yandex Maps toolkit

Yii2 toolset for working with Yandex Map

  1. Installation
  2. Usage
  3. Interactivity
  4. License

Widgets list:

  • CoordsInput: selection of coordinates on the map;
  • StreetInput: jui autocomplete with street names of specified city;
  • MapWidget: displays the Yandex map and the placemarks.

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require kl83/yii2-ymaps @dev

or add

"kl83/yii2-ymaps": "@dev"

to the require section of your composer.json file.

Usage

CoordsInput
<?= $form->field($model, 'coords')->widget('kl83\ymaps\CoordsInput', [
  'options' => [], // Html-attributes of container
  'ymapsClientOptions' => [], // Yandex map JS settings
  'placemarkClientProperties' => [], // Placemark JS properties
  'placemarkClientOptions' => [], // Placemark JS options
]) ?>
StreetInput
<?= $form->field($model, 'street')->widget('kl83\ymaps\StreetInput', [
  'options' => [], // Html-attributes
  'city' => '', // Search streets in specified city
]) ?>
MapWidget
<?= MapWidget::widget([
    'mapState' => [
        'center' => [55.76, 37.64],
        'zoom' => 16,
    ],
    'placemarks' => [
        [
            [55.76, 37.64],
            [], // properties
            [], // options
        ],
        [
            [55.76, 37.64],
        ],
    ],
]) ?>

Interactivity

CoordsInput

Finds the specified address on the map, and moves the placemark to it.

$('.widget').coordsInput('search', 'Some address');
StreetInput

Get or set the city to search on.

$('.widget').streetInput('city'); // Get
$('.widget').streetInput('city', 'Some city'); // Set

License

MIT License

0 0
1 follower
110 downloads
Yii Version: 2.0
License: MIT
Category: User Interface
Developed by: Aleksandr Solovyov
Created on: Aug 24, 2018
Last updated: (not set)
Packagist Profile
Github Repository

Related Extensions