PHPackages                             2amigos/yii2-leaflet-geocoder-plugin - 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. 2amigos/yii2-leaflet-geocoder-plugin

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

2amigos/yii2-leaflet-geocoder-plugin
====================================

Yii2 LeafLet Plugin to provide support for address lookup with dropdown list of results to Leaflet.

1.0.3(7y ago)414.7k↑100%8[1 issues](https://github.com/2amigos/yii2-leaflet-geocoder-plugin/issues)1BSD-3-ClausePHP

Since Apr 23Pushed 6y ago8 watchersCompare

[ Source](https://github.com/2amigos/yii2-leaflet-geocoder-plugin)[ Packagist](https://packagist.org/packages/2amigos/yii2-leaflet-geocoder-plugin)[ Docs](http://yiiwheels.com/extension/leaflet-geocoder-plugin)[ RSS](/packages/2amigos-yii2-leaflet-geocoder-plugin/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (2)Versions (7)Used By (1)

Geo Search Plugin
=================

[](#geo-search-plugin)

[![Latest Version](https://camo.githubusercontent.com/3b977e73dd0e6f8a9df9a6d30decb4ddf1a9325b3c34730c55f41ceac792b062/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7461672f32616d69676f732f796969322d6c6561666c65742d67656f636f6465722d706c7567696e2e7376673f7374796c653d666c61742d737175617265266c6162656c3d72656c65617365)](https://github.com/2amigos/yii2-leaflet-geocoder-plugin/tags)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/c419315a54df5febbe4d292c6e3589347eded792217b29bce0fc48b52a9e95e8/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f32616d69676f732f796969322d6c6561666c65742d67656f636f6465722d706c7567696e2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/2amigos/yii2-leaflet-geocoder-plugin)[![Coverage Status](https://camo.githubusercontent.com/4c9f4565209f80a4902f3b03a3698d81a28f144c8771e67e8b18fac1e39bf638/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f32616d69676f732f796969322d6c6561666c65742d67656f636f6465722d706c7567696e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/2amigos/yii2-leaflet-geocoder-plugin/code-structure)[![Quality Score](https://camo.githubusercontent.com/b639345bfc7820c2ebc7a7ff811f820f286d79b2e4d616606220250538c867f9/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f32616d69676f732f796969322d6c6561666c65742d67656f636f6465722d706c7567696e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/2amigos/yii2-leaflet-geocoder-plugin)[![Total Downloads](https://camo.githubusercontent.com/f2f11c71155a98c92009cb39ce0e0e2874d3d9617c4ae26329e7d9bd1581e09a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f32616d69676f732f796969322d6c6561666c65742d67656f636f6465722d706c7567696e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/2amigos/yii2-leaflet-geocoder-plugin)

Yii 2 [LeafletJs](http://leafletjs.com/) Plugin that adds support for address lookup to Leaflet with dropdown list capabilities and loading icon feedback. This Plugin works in conjunction with [LeafLet](https://github.com/2amigos/yii2-leaflet-extension) library for [Yii 2](https://github.com/yiisoft/yii2)framework.

***Important***The libraries used on this plugin have been modified from [the original plugin source](https://github.com/perliedman/leaflet-control-geocoder). So, if you wish to modify the plugin, remember that you cannot update it from its original source.

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

[](#installation)

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

Either run

```
composer require 2amigos/yii2-leaflet-geocoder-plugin:~1.0

```

or add

```
"2amigos/yii2-leaflet-geocoder-plugin" : "~1.0"
```

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

Usage
-----

[](#usage)

There are four services that you can use, even though we have implemented only three:

- Nominatim
- Bing
- MapQuest

Anybody will to help integrate more services, is very welcome :)

```
use dosamigos\leaflet\layers\TileLayer;
use dosamigos\leaflet\LeafLet;
use dosamigos\leaflet\types\LatLng;
use dosamigos\leaflet\layers\Marker;
use dosamigos\leaflet\plugins\geocoder\ServiceNominatim;
use dosamigos\leaflet\plugins\geocoder\GeoCoder;

// lets use nominating service
$nominatim = new ServiceNominatim();

// create geocoder plugin and attach the service
$geoCoderPlugin = new GeoCoder([
    'service' => $nominatim,
    'clientOptions' => [
        // we could leave it to allocate a marker automatically
        // but I want to have some fun
        'showMarker' => false
    ]
]);

// add a marker to center
$center = new LatLng(['lat' => '49.006889', 'lng' => '8.403653']);
$marker = new Marker([
    'name' => 'geoMarker',
    'latLng' => $center,
    'clientOptions' => ['draggable' => true], // draggable marker
    'clientEvents' => [
        'dragend' => 'function(e){
            console.log(e.target._latlng.lat, e.target._latlng.lng);
        }'
    ]
]);

// configure the tile layer
$tileLayer = new TileLayer([
    'urlTemplate' => 'http://otile{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpeg',
    'clientOptions' => [
        'attribution' => 'Tiles Courtesy of MapQuest ' .
            ', ' .
            'Map data &copy; OpenStreetMap contributors, ' .
            'CC-BY-SA',
        'subdomains' => '1234'
    ]
]);

// initialize our leafLet component
$leafLet = new LeafLet([
    'name' => 'geoMap',
    'tileLayer' => $tileLayer,
    'center' => $center,
    'zoom' => 10,
    'clientEvents' => [
        // I added an event to ease the collection of new position
        'geocoder_showresult' => 'function(e){
            // set markers position
            geoMarker.setLatLng(e.Result.center);
        }'
    ]
]);

// add the marker
$leafLet->addLayer($marker);

// install the plugin
$leafLet->installPlugin($geoCoderPlugin);

// run the widget (you can also use dosamigos\leaflet\widgets\Map::widget([...]))
echo $leafLet->widget();

```

Testing
-------

[](#testing)

```
$ ./vendor/bin/phpunit
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Antonio Ramirez](https://github.com/tonydspaniard)
- [All Contributors](../../contributors)

License
-------

[](#license)

The BSD License (BSD). Please see [License File](LICENSE.md) for more information.

> [![2amigOS!](https://camo.githubusercontent.com/9fd8f1de41dc23003bb2a54034cb6658dde5be97092e195a62d629d0d7fa7f6c/687474703a2f2f7777772e67726176617461722e636f6d2f6176617461722f35353336333339346437323934356666376564333132353536656330343165302e706e67)](http://www.2amigos.us)
> *Web development has never been so fun!*
> [www.2amigos.us](http://www.2amigos.us)

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community22

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~361 days

Recently: every ~452 days

Total

6

Last Release

2646d ago

Major Versions

0.1.1 → 1.0.02015-04-07

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/566016?v=4)[Antonio Ramirez](/maintainers/tonydspaniard)[@tonydspaniard](https://github.com/tonydspaniard)

---

Top Contributors

[![aayaresko](https://avatars.githubusercontent.com/u/8190713?v=4)](https://github.com/aayaresko "aayaresko (4 commits)")[![tonydspaniard](https://avatars.githubusercontent.com/u/566016?v=4)](https://github.com/tonydspaniard "tonydspaniard (2 commits)")[![kasoft](https://avatars.githubusercontent.com/u/3940053?v=4)](https://github.com/kasoft "kasoft (1 commits)")[![pawelkania](https://avatars.githubusercontent.com/u/9013316?v=4)](https://github.com/pawelkania "pawelkania (1 commits)")[![squio](https://avatars.githubusercontent.com/u/169410?v=4)](https://github.com/squio "squio (1 commits)")[![studio255](https://avatars.githubusercontent.com/u/3940053?v=4)](https://github.com/studio255 "studio255 (1 commits)")

---

Tags

pluginyii2extensionwidgetmapsyiileafletyii 22amigos

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/2amigos-yii2-leaflet-geocoder-plugin/health.svg)

```
[![Health](https://phpackages.com/badges/2amigos-yii2-leaflet-geocoder-plugin/health.svg)](https://phpackages.com/packages/2amigos-yii2-leaflet-geocoder-plugin)
```

PHPackages © 2026

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