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

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

2amigos/yii2-leaflet-extension
==============================

LeafLet Mobile-Friendly Interactive Maps Extension Library for Yii2.

1.1.0(9y ago)29108.3k↓29.3%27[17 issues](https://github.com/2amigos/yii2-leaflet-extension/issues)[1 PRs](https://github.com/2amigos/yii2-leaflet-extension/pulls)9BSD-3-ClausePHP

Since Apr 20Pushed 6y ago16 watchersCompare

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

READMEChangelogDependencies (3)Versions (10)Used By (9)

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

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

[![Latest Version](https://camo.githubusercontent.com/a4b1ef59bfbaec4c55f775e26264af7cc1a3153b4f78dfa1fb62d07a70cb732a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7461672f32616d69676f732f796969322d6c6561666c65742d657874656e73696f6e2e7376673f7374796c653d666c61742d737175617265266c6162656c3d72656c65617365)](https://github.com/2amigos/yii2-leaflet-extension/tags)[![Software License](https://camo.githubusercontent.com/b60331a2084501dc07cf6d6964c0da58dd005d89c45cf3b28b4b22b60f5ec00f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4253442d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/d5bcbc8ed0194113ebe949036ed2416290224bd32bed3de67af2bd63b63f60ae/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f32616d69676f732f796969322d6c6561666c65742d657874656e73696f6e2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/2amigos/yii2-leaflet-extension)[![Coverage Status](https://camo.githubusercontent.com/8564d8f076ff5c5b68b3d5a0d79bbe0bb6bc5a7131c28a37eed69f7e1d2b5ffe/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f32616d69676f732f796969322d6c6561666c65742d657874656e73696f6e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/2amigos/yii2-leaflet-extension/code-structure)[![Total Downloads](https://camo.githubusercontent.com/02a409ff66a4639ad0032aded1f2e47e451381752471eefc0cdc79b2183bbde9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f32616d69676f732f796969322d6c6561666c65742d657874656e73696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/2amigos/yii2-leaflet-extension)

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

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

[](#installation)

The preferred way to install this extension is through [composer](http://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 2amigos/yii2-leaflet-extension:~1.0

```

or add

```
"2amigos/yii2-leaflet-extension" : "~1.0"
```

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

Usage
-----

[](#usage)

One of the things to take into account when working with [LeafletJs](http://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](http://developer.mapquest.com/):

```
// first lets setup the center of our map
$center = new dosamigos\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 \dosamigos\leaflet\layers\Marker(['latLng' => $center, 'popupContent' => 'Hi!']);

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

// now our component and we are going to configure it
$leaflet = new \dosamigos\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 \dosamigos\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](http://leafletjs.com/reference.html)

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

41

—

FairBetter than 89% of packages

Maintenance8

Infrequent updates — may be unmaintained

Popularity45

Moderate usage in the ecosystem

Community29

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 90.2% 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 ~134 days

Recently: every ~182 days

Total

9

Last Release

3340d ago

Major Versions

0.1.3 → 1.0.02015-03-28

### Community

Maintainers

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

---

Top Contributors

[![tonydspaniard](https://avatars.githubusercontent.com/u/566016?v=4)](https://github.com/tonydspaniard "tonydspaniard (74 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)")[![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/2amigos-yii2-leaflet-extension/health.svg)

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

PHPackages © 2026

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