PHPackages                             proximitymad/yii2-mapspicker-widget - 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. proximitymad/yii2-mapspicker-widget

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

proximitymad/yii2-mapspicker-widget
===================================

A widget for the Yii2 framework to render a Map with Google Maps and allow the user to pick a location on the map and get the coordinates.

1.0.6(6y ago)02201MITPHP

Since Jan 18Pushed 6y ago2 watchersCompare

[ Source](https://github.com/proximity-mad/yii2-gmapspicker-widget)[ Packagist](https://packagist.org/packages/proximitymad/yii2-mapspicker-widget)[ RSS](/packages/proximitymad-yii2-mapspicker-widget/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (4)DependenciesVersions (7)Used By (0)

yii2-mapspicker-widget
======================

[](#yii2-mapspicker-widget)

A widget for the Yii2 framework to render a Map with Google Maps and allow the user to pick a location on the map and get the coordinates.

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

[](#installation)

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

Either run

```
php composer.phar require --prefer-dist proximitymad/yii2-mapspicker-widget "1.0.*"

```

or add

```
"proximitymad/yii2-mapspicker-widget": "1.0.*"

```

to the require section of your `composer.json` file.

Usage
-----

[](#usage)

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

```
echo \app\components\widgets\Maps\MapPicker::widget([
    'apiKey'=>'gmaps-api-key' //required,
    'search'=>'Madrid, Spain' //required
]);
```

### Required parameters

[](#required-parameters)

- **apiKey**: The google maps api key, you can get it following the instructions [here](https://developers.google.com/maps/documentation/javascript/get-api-key) (only required when **loadMapApi** is set to true).
- **search**: The search string to start the map with, for example *Madrid, Spain*. Can be coordinates as well ( *40.4525784,-3.6813066* ).

### Optional parameters

[](#optional-parameters)

- **loadMapApi**: If set to false, it will not load the Google Maps JS API in case you are already including it *default: true*.
- **mapId**: The ID of the map, if it is left empty it will be autogenerated.
- **width**: The width of the map *default: 100*.
- **height**: The height of the map *default: 100*.
- **latFieldClass**: The DOM element class which contains the input field for latitude *default: field-lat*.
- **lngFieldClass**: The DOM element class which contains the input field for longitude *default: field-lng*.
- **errorClass**: The DOM element class which contains the error message in case no results are found *default: search-error*.
- **errorMsg**: The error message to display in case no results are found *default: No results found*.
- **searchField**:
    - **inputClass**: The input field with the search string *default: search-field*.
    - **buttonClass**: The button to start the search *default: btn-search*.
- **mapOptions**:
    - **zoom**: the zoom to start the map with *default: 16*.
    - **streetViewControl**: Enables or disables street view control or no *default: false*
- **show**: Set to false if you don't want the widget to autoload.
- **scriptsPosition**: The position where the scripts should load. See [yii\\web\\View](https://www.yiiframework.com/doc/api/2.0/yii-web-view) constants for positions.

Examples
--------

[](#examples)

```

```

```
echo \app\components\widgets\Maps\MapPicker::widget([
    'apiKey'=>"my-api-key",
    'width'=>'100%',
    'height'=>300,
    'search'=>"Barcelona, Spain",
    'errorMsg'=>"Ey, your search didn't retrieve any results",
    'latFieldClass'=>"my-lat-field"
    'lngFieldClass'=>"my-lng-field"
]);
```

### Example with search

[](#example-with-search)

```

Search
```

```
echo \app\components\widgets\Maps\MapPicker::widget([
    'apiKey'=>"my-api-key",
    'width'=>'100%',
    'height'=>300,
    'search'=>"Barcelona, Spain",
    'errorMsg'=>"Ey, your search didn't retrieve any results",
    'searchField'=>[
        'inputClass'=>'my-search-field',
        'buttonClass'=>'my-button'
    ]
]);
```

Events
------

[](#events)

After a search or after picking a place on the map an event is triggered with the search results, the event is **mappicker-searchresults**. The results contains all the results and the components (country, state, province and locality).

#### Example

[](#example)

```
$(document).on('mappicker-searchresults', function(evt, data){
    console.log(data.results);
    console.log(data.components);
})
```

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 83.3% 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.

###  Release Activity

Cadence

Every ~224 days

Recently: every ~280 days

Total

6

Last Release

2330d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7389153?v=4)[Proximity New Zealand](/maintainers/proximity)[@proximity](https://github.com/proximity)

---

Top Contributors

[![nvanderburg](https://avatars.githubusercontent.com/u/73654874?v=4)](https://github.com/nvanderburg "nvanderburg (5 commits)")[![nilsburg](https://avatars.githubusercontent.com/u/1023621?v=4)](https://github.com/nilsburg "nilsburg (1 commits)")

### Embed Badge

![Health badge](/badges/proximitymad-yii2-mapspicker-widget/health.svg)

```
[![Health](https://phpackages.com/badges/proximitymad-yii2-mapspicker-widget/health.svg)](https://phpackages.com/packages/proximitymad-yii2-mapspicker-widget)
```

###  Alternatives

[fedeisas/laravel-js-routes

Laravel 4 routes from Javascript

62136.5k](/packages/fedeisas-laravel-js-routes)[minime/brasil-endereco

Brasil/Endereco é um componente de consulta que facilita a obtenção de endereços a partir do site dos correios

153.1k](/packages/minime-brasil-endereco)

PHPackages © 2026

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