PHPackages                             boriskorobkov/yii2-leaflet-extension - 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. boriskorobkov/yii2-leaflet-extension

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

boriskorobkov/yii2-leaflet-extension
====================================

LeafLet Mobile-Friendly Interactive Maps Extension Library for Yii2.

2.0.1(2mo ago)012BSD-3-ClausePHPPHP ^8.1

Since Jan 3Pushed 2mo agoCompare

[ Source](https://github.com/BorisKorobkov/yii2-leaflet-extension)[ Packagist](https://packagist.org/packages/boriskorobkov/yii2-leaflet-extension)[ Docs](https://github.com/BorisKorobkov)[ RSS](/packages/boriskorobkov-yii2-leaflet-extension/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (5)Used By (0)

LeafLet Extension for Yii2
==========================

[](#leaflet-extension-for-yii2)

Extension library to display interactive maps with [LeafletJs](https://leafletjs.com/)

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

[](#installation)

The preferred way to install this extension is through [composer](https://getcomposer.org/download/). This requires the [`composer-asset-plugin`](https://github.com/francoispluchino/composer-asset-plugin), which is also a dependency for yii2 – so if you have yii2 installed, you are most likely already set.

Either run

```
composer require boriskorobkov/yii2-leaflet-extension:^2.0.0
```

or add

```
"boriskorobkov/yii2-leaflet-extension" : "^2.0.0"
```

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

Migration from 1.x to 2.x
-------------------------

[](#migration-from-1x-to-2x)

1. Replace namespace `dosamigos/yii2-leaflet-extension` with `boriskorobkov/yii2-leaflet-extension` in your code
2. If you use a custom widget, check the correct usage of the `;` symbol

Usage
-----

[](#usage)

One of the things to take into account when working with [LeafletJs](https://leafletjs.com/) is that we need a Tile Provider. Is very important, if we fail to provide a Tile Provider Url, the map will display plain, without any maps at all.

The following example, is making use of [MapQuest](https://developer.mapquest.com/):

```
// first lets setup the center of our map
$center = new boriskorobkov\leaflet\types\LatLng(['lat' => 51.508, 'lng' => -0.11]);

// now lets create a marker that we are going to place on our map
$marker = new \boriskorobkov\leaflet\layers\Marker(['latLng' => $center, 'popupContent' => 'Hi!']);

// The Tile Layer (very important)
$tileLayer = new \boriskorobkov\leaflet\layers\TileLayer([
   'urlTemplate' => 'https://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' => ['1', '2', '3', '4'],
    ],
]);

// now our component and we are going to configure it
$leaflet = new \boriskorobkov\leaflet\LeafLet([
    'center' => $center, // set the center
]);
// Different layers can be added to our map using the `addLayer` function.
$leaflet->addLayer($marker)      // add the marker
        ->addLayer($tileLayer);  // add the tile layer

// finally render the widget
echo \boriskorobkov\leaflet\widgets\Map::widget(['leafLet' => $leaflet]);

// we could also do
// echo $leaflet->widget();
```

Testing
-------

[](#testing)

To test the extension, is better to clone this repository on your computer. After, go to the extensions folder and do the following (assuming you have `composer` installed on your computer):

```
$ composer install --no-interaction --prefer-source --dev
```

Once all required libraries are installed then do:

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

Further Information
-------------------

[](#further-information)

For further information regarding the multiple settings of LeafLetJS library please visit [its API reference](https://leafletjs.com/reference.html)

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

[](#contributing)

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

Credits
-------

[](#credits)

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

License
-------

[](#license)

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

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

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance84

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

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

Total

2

Last Release

83d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5031770af96ef24689c7efece3596c494946d2927264770f47c1880a2f4ed11b?d=identicon)[BorisKorobkov](/maintainers/BorisKorobkov)

---

Top Contributors

[![BorisKorobkov](https://avatars.githubusercontent.com/u/16425048?v=4)](https://github.com/BorisKorobkov "BorisKorobkov (7 commits)")[![tarleb](https://avatars.githubusercontent.com/u/507994?v=4)](https://github.com/tarleb "tarleb (4 commits)")[![philippfrenzel](https://avatars.githubusercontent.com/u/2319890?v=4)](https://github.com/philippfrenzel "philippfrenzel (2 commits)")[![renovate-bot](https://avatars.githubusercontent.com/u/25180681?v=4)](https://github.com/renovate-bot "renovate-bot (2 commits)")[![resurtm](https://avatars.githubusercontent.com/u/100198?v=4)](https://github.com/resurtm "resurtm (2 commits)")

---

Tags

yii2extensionwidgetmapsyiileaflet2amigos

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/boriskorobkov-yii2-leaflet-extension/health.svg)

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

PHPackages © 2026

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