PHPackages                             mirocow/yii2-yandex-maps - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mirocow/yii2-yandex-maps

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

mirocow/yii2-yandex-maps
========================

Yii 2 yandex map module

2324.5k↓40.7%29[3 issues](https://github.com/Mirocow/yii2-yandex-maps/issues)1PHP

Since May 21Pushed 6y ago6 watchersCompare

[ Source](https://github.com/Mirocow/yii2-yandex-maps)[ Packagist](https://packagist.org/packages/mirocow/yii2-yandex-maps)[ RSS](/packages/mirocow-yii2-yandex-maps/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (1)

Yii2 Yandex Maps Components
===========================

[](#yii2-yandex-maps-components)

[![Latest Stable Version](https://camo.githubusercontent.com/24a58aadd8dba788cf47f4a51584f4c14d73b1523bc465ea6dd466219435e6a1/68747470733a2f2f706f7365722e707567782e6f72672f6d69726f636f772f796969322d79616e6465782d6d6170732f762f737461626c65)](https://packagist.org/packages/mirocow/yii2-yandex-maps) [![Latest Unstable Version](https://camo.githubusercontent.com/7820a74625da41f1d7ce7b1a0bc98f1a92b2935d6a6610b5b964781da94aeeea/68747470733a2f2f706f7365722e707567782e6f72672f6d69726f636f772f796969322d79616e6465782d6d6170732f762f756e737461626c65)](https://packagist.org/packages/mirocow/yii2-yandex-maps) [![Total Downloads](https://camo.githubusercontent.com/86afdaa3757ac7737922feb7d67b9c3b0fca1f5b7868160402d704270e87d4ed/68747470733a2f2f706f7365722e707567782e6f72672f6d69726f636f772f796969322d79616e6465782d6d6170732f646f776e6c6f616473)](https://packagist.org/packages/mirocow/yii2-yandex-maps) [![Daily Downloads](https://camo.githubusercontent.com/555c943f2620facdab4e9f6db8287ba44f7d1a8dfcce552d4de06ddc026b4727/68747470733a2f2f706f7365722e707567782e6f72672f6d69726f636f772f796969322d79616e6465782d6d6170732f642f6461696c79)](https://packagist.org/packages/mirocow/yii2-yandex-maps) [![License](https://camo.githubusercontent.com/4a057d44ce4467d24150a0cc4ca792626385397cb1162ae6fa03fcd58dd571a3/68747470733a2f2f706f7365722e707567782e6f72672f6d69726f636f772f796969322d79616e6465782d6d6170732f6c6963656e7365)](https://packagist.org/packages/mirocow/yii2-yandex-maps)

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

### Add repositor

[](#add-repositor)

```
    "repositories": [
        {
            "type": "git",
            "url": "https://github.com/mirocow/yii2-yandex-maps.git"
        }
    ]
```

and then

```
php composer.phar require --prefer-dist "mirocow/yii2-yandex-maps" "*"

```

or add

```
"mirocow/yii2-yandex-maps" : "*"
```

to the require section of your application's `composer.json` file.

---

For last Yii2 2.X version please use patch

Components
----------

[](#components)

- [`mirocow\yandexmaps\Api`](https://github.com/mirocow/yii2-yandex-maps#mirocowyandexmapsapi)
- [`mirocow\yandexmaps\Map`](https://github.com/mirocow/yii2-yandex-maps#mirocowyandexmapsmap)
- [`mirocow\yandexmaps\Canvas`](https://github.com/mirocow/yii2-yandex-maps#mirocowyandexmapscanvas)
- [`mirocow\yandexmaps\Placemark`](https://github.com/mirocow/yii2-yandex-maps#mirocowyandexmapsplacemark)
- [`mirocow\yandexmaps\Polygon`](https://github.com/mirocow/yii2-yandex-maps#mirocowyandexmapspolygon)
- [`mirocow\yandexmaps\Controls`](https://github.com/mirocow/yii2-yandex-maps#mirocowyandexmapscontrols)
- [`mirocow\yandexmaps\Polyline`](https://github.com/mirocow/yii2-yandex-maps#mirocowyandexmapspolyline)
- [`mirocow\yandexmaps\GeoObject`](https://github.com/mirocow/yii2-yandex-maps#mirocowyandexmapsgeoobject)
- TODO: [Geo XML](http://api.yandex.ru/maps/doc/jsapi/2.x/dg/concepts/geoxml.xml)
- TODO: [Balloon](http://api.yandex.ru/maps/doc/jsapi/2.x-stable/ref/reference/Balloon.xml)
- TODO: [Hint](http://api.yandex.ru/maps/doc/jsapi/2.x-stable/ref/reference/Hint.xml)
- TODO: [Clusterer](http://api.yandex.ru/maps/doc/jsapi/2.x/ref/reference/Clusterer.xml)

### mirocow\\yandexmaps\\Api

[](#mirocowyandexmapsapi)

Application components which register scripts.

**Usage**

Attach component to application (e.g. edit config/main.php):

```
'components' => [
	'yandexMapsApi' => [
		'class' => 'mirocow\yandexmaps\Api',
	]
 ],
```

### mirocow\\yandexmaps\\Map

[](#mirocowyandexmapsmap)

Map instance.

**Usage**

```
    $map = new \mirocow\yandexmaps\Map('yandex_map', [
            'center' => [55.7372, 37.6066],
            'zoom' => 10,
            // Enable zoom with mouse scroll
            'behaviors' => array('default', 'scrollZoom'),
            'type' => "yandex#map",
        ],
        [
            // Permit zoom only fro 9 to 11
            'minZoom' => 9,
            'maxZoom' => 11,
            'controls' => [
              "new ymaps.control.SmallZoomControl()",
              "new ymaps.control.TypeSelector(['yandex#map', 'yandex#satellite'])",
            ],
        ]
    );
```

### mirocow\\yandexmaps\\Canvas

[](#mirocowyandexmapscanvas)

This is widget which render html tag for your map.

**Usage**

Simple add widget to view:

```
echo \mirocow\yandexmaps\Canvas::widget([
        'htmlOptions' => [
            'style' => 'height: 400px;',
        ],
        'map' => $map,
    ]);
```

### mirocow\\yandexmaps\\Controls

[](#mirocowyandexmapscontrols)

```
      'controls' => [
          // v 2.1
          'new ymaps.control.ZoomControl({options: {size: "small"}})',
          //'new ymaps.control.TrafficControl({options: {size: "small"}})',
          //'new ymaps.control.GeolocationControl({options: {size: "small"}})',
          'search' => 'new ymaps.control.SearchControl({options: {size: "small"}})',
          //'new ymaps.control.FullscreenControl({options: {size: "small"}})',
          //'new ymaps.control.RouteEditor({options: {size: "small"}})',
      ],
```

### mirocow\\yandexmaps\\GeoObject

[](#mirocowyandexmapsgeoobject)

#### mirocow\\yandexmaps\\Placemark

[](#mirocowyandexmapsplacemark)

```
    $placemark = new mirocow\yandexmaps\objects\Placemark([
            55.7372,
            37.6066
    ], [

    ], [
            'draggable' => true
      ]
    );
```

#### mirocow\\yandexmaps\\Polygon

[](#mirocowyandexmapspolygon)

TODO:

#### mirocow\\yandexmaps\\Clusterer

[](#mirocowyandexmapsclusterer)

```
    for (var i in map_point) {
    points[i] = new ymaps.GeoObject({
     geometry : {
      type: 'Point',
      coordinates : [map_point[i]['lat'],map_point[i]['lng']]
     },
     properties : {
      balloonContentBody : map_point[i]['body']
      // hintContent : 'подробнее'
     }
    },
    {
     iconImageHref: '/i/' + map_point[i]['spec']+'.png',
     iconImageSize: [29,29],
     balloonIconImageHref: '/i/' + map_point[i]['spec']+'.png',
     balloonIconImageSize: [29,29],
     hasBalloon: true
    });
   }

   var clusterer = new ymaps.Clusterer();
   clusterer.add(points);
   map.geoObjects.add(clusterer);
```

#### mirocow\\yandexmaps\\Polyline

[](#mirocowyandexmapspolyline)

TODO:

Examples:
---------

[](#examples)

User form with yandex map:
--------------------------

[](#user-form-with-yandex-map)

```
