PHPackages                             ttungbmt/yii2-leaflet-geocoder - 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. ttungbmt/yii2-leaflet-geocoder

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

ttungbmt/yii2-leaflet-geocoder
==============================

Leaflet Interactive Maps Extension Library for Yii2.

1.0.0(7y ago)06MIT

Since Jun 14Compare

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

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

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 ttungbmt/yii2-leaflet-geocoder "@dev"

```

or add

```
"ttungbmt/yii2-leaflet-geocoder" : "@dev"
```

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
- Google
- HCMGIS
- Mapbox
- Here

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

```
use dosamigos\leaflet\layers\TileLayer;
use ttungbmt\leaflet\Leaflet;
use dosamigos\leaflet\types\LatLng;
use ttungbmt\leaflet\geocoder\services\ServiceHCMGIS;
use ttungbmt\leaflet\geocoder\GeoCoder;

// lets use nominating service
$hcmgis = new ServiceHCMGIS();

// create geocoder plugin and attach the service
$geoCoderPlugin = new GeoCoder([
    'service' => $hcmgis,
    'clientOptions' => [
        // we could leave it to allocate a marker automatically
        // but I want to have some fun
        'defaultMarkGeocode' => false
    ],
    'clientEvents'  => [
        'markgeocode' => new JsExpression('function(e){ console.log(e) }')
    ]
]);

// add a marker to center
$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://{s}.google.com/vt/lyrs={map}&x={x}&y={y}&z={z}',
    'clientOptions' => [
        'map' => 'm',
        'attribution' => ''&copy; Google Maps',
        'subdomains' => ['mt0', 'mt1', 'mt2', 'mt3'],
    ]
]);

// initialize our leafLet component
$leaflet = new Leaflet([
    'name' => 'geoMap',
    'tileLayer' => $tileLayer,
    'center' => $center,
    'zoom' => 10,
]);

// 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

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

2573d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/12232155?v=4)[Trương Thanh Tùng](/maintainers/ttungbmt)[@ttungbmt](https://github.com/ttungbmt)

---

Tags

yii2extensionwidgetmapsyiileaflet2amigos

### Embed Badge

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

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

PHPackages © 2026

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