PHPackages                             loveorigami/yii2-gmap - 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. loveorigami/yii2-gmap

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

loveorigami/yii2-gmap
=====================

GoogleMaps Widget displays a set of user addresses as markers on the map.

1381[2 issues](https://github.com/loveorigami/yii2-gmap/issues)JavaScript

Since Aug 20Pushed 6y ago2 watchersCompare

[ Source](https://github.com/loveorigami/yii2-gmap)[ Packagist](https://packagist.org/packages/loveorigami/yii2-gmap)[ RSS](/packages/loveorigami-yii2-gmap/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Google Maps Widgets for Yii2
============================

[](#google-maps-widgets-for-yii2)

GoogleMaps Widget displays a set of user addresses as markers on the map.

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

[](#installation)

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

Either run

```
php composer.phar require loveorigami/yii2-gmap "*"

```

or add

```
"loveorigami/yii2-gmap": "*"

```

to the require section of your composer.json.

Configuration
-------------

[](#configuration)

To configure the Google Maps key or other options like language, version, library, or map options:

```
echo lo\widgets\gmap\MarkersWidget::widget([
    'googleMapsUrlOptions' => [
        'key' => 'this_is_my_key',
        'language' => 'id',
        'version' => '3.1.18',
    ],
    'googleMapsOptions' => [
        'mapTypeId' => 'roadmap',
        'tilt' => 45,
        'zoom' => 5,
    ],
]);
```

OR via yii params configuration. For example:

```
'params' => [
    'googleMapsUrlOptions' => [
        'key' => 'this_is_my_key',
        'language' => 'id',
        'version' => '3.1.18',
     ],
    'googleMapsOptions' => [
        'mapTypeId' => 'roadmap',
        'tilt' => 45,
        'zoom' => 10,
    ],
],
```

To get key, please visit [page](https://developers.google.com/maps/documentation/javascript/get-api-key)

Google Maps Options you can find them on the [options page](https://developers.google.com/maps/documentation/javascript/reference)

Widgets
-------

[](#widgets)

- Markers Widget

---

To use GoogleMaps, you need to configure its \[\[locations\]\] property. For example:

```
echo lo\widgets\gmap\MarkersWidget::widget([
		[
			'position' => [$model->lat, $model->lng],
			'open' => true,
			'content' => $model->name,
		],
		[
			'position' => [45.143400, -5.372400],
			'content' => 'My Marker',
		]
]);
```

- Select Map Location Widget

---

Declare model class which will save geographic coordinates:

```
class SearchLocation extends \yii\base\Model
{
    ...
    public $address;
    public $longitude;
    public $latitude;
    ...
}
```

Render widget:

```
$model = new SearchLocation();
$form = \yii\widgets\ActiveForm::begin();
...
$form->field($model, 'address')->widget(\lo\widgets\gmap\SelectMapLocationWidget::class, [
    'attributeLatitude' => 'latitude',
    'attributeLongitude' => 'longitude',
]);
...
\yii\widgets\ActiveForm::end();
```

To use movable marker on the map describe draggable option:

```
$model = new SearchLocation();
$form = \yii\widgets\ActiveForm::begin();
...
$form->field($model, 'address')->widget(\lo\widgets\gmap\SelectMapLocationWidget::className(), [
    'attributeLatitude' => 'latitude',
    'attributeLongitude' => 'longitude',
    'draggable' => true,
]);
...
\yii\widgets\ActiveForm::end();
```

To use custom field template use placeholder {map} for ActiveField:

```
$model = new SearchLocation();
$form = \yii\widgets\ActiveForm::begin();
...
$form->field($model, 'address', [
    'template' => '{label}{input}{map}{error}',
])->widget(\lo\widgets\gmap\SelectMapLocationWidget::className(), [
    'attributeLatitude' => 'latitude',
    'attributeLongitude' => 'longitude',
]);
...
\yii\widgets\ActiveForm::end();
```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/e7cd51e41d7a25605da02f494d1bd7f7b7deadad23080d9ec1021ec9188498b7?d=identicon)[loveorigami](/maintainers/loveorigami)

---

Top Contributors

[![loveorigami](https://avatars.githubusercontent.com/u/98164?v=4)](https://github.com/loveorigami "loveorigami (21 commits)")

---

Tags

gmapsmarkerwidgetyii2

### Embed Badge

![Health badge](/badges/loveorigami-yii2-gmap/health.svg)

```
[![Health](https://phpackages.com/badges/loveorigami-yii2-gmap/health.svg)](https://phpackages.com/packages/loveorigami-yii2-gmap)
```

###  Alternatives

[cloudcake/nova-snowball

A beautiful contrast of dark blue and white packaged for Laravel Nova as a theme.

3844.2k](/packages/cloudcake-nova-snowball)[gomachan46/state-machine

simple state machine with annotations for PHP, inspired by AASM known as a Ruby state machine.

1893.9k](/packages/gomachan46-state-machine)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
