codru/yii2-static-map

Extension for generating static maps (for example for contacts page). Now supports google map and openstreet map

Installs: 409

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 2

Forks: 3

Open Issues: 0

Type:yii2-extension

dev-master 2016-02-01 20:00 UTC

This package is not auto-updated.

Last update: 2024-04-09 05:11:13 UTC


README

Extension for generating static maps (for example for contacts page). Now support google map and openstreet map

Build Status Scrutinizer Code Quality

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist codru/yii2-static-map "*"

or add

"codru/yii2-static-map": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

<?= \codru\staticmap\StaticMap::widget(
        [
            'map' => [
                'class' => \codru\staticmap\types\Google::className(),
                'options' => [
                    'center' => '40,50',
                    'zoom' => '13',
                    'size' => '640x100',
                    'scale' => '2',
                    'language' => Yii::$app->language,
                    'markers' => [
                        'size' => 'tiny',
                        '40,50',
                    ],
                ],
            ],
        ]
) ?>

Or

<?= \codru\staticmap\StaticMap::widget(
        [
            'map' => [
                'class' => \codru\staticmap\types\OpenStreet::className(),
                'options' => [
                    'center' => '40,50',
                    'zoom' => '15',
                    'size' => '1024x200',
                    'language' => Yii::$app->language,
                    'markers' => [
                        '40,50',
                        'ol-marker',
                    ],
                ],
            ],
        ]
) ?>