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

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

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

Yii2 LeafLet Plugin to provide beautiful, sophisticated, high performance marker clustering solution with smooth animations and lots of great features.

1.0.0(11y ago)45.5k11[2 PRs](https://github.com/2amigos/yii2-leaflet-markercluster-plugin/pulls)1BSD-3-ClauseJavaScript

Since Feb 17Pushed 5y ago19 watchersCompare

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

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

Marker Cluster Plugin
=====================

[](#marker-cluster-plugin)

[![Latest Version](https://camo.githubusercontent.com/eaf3040aee9b2064488c66823d1bc0c9d30352af7eb23a0a90191bd88cce66f8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7461672f32616d69676f732f796969322d6c6561666c65742d6d61726b6572636c75737465722d706c7567696e2e7376673f7374796c653d666c61742d737175617265266c6162656c3d72656c65617365)](https://github.com/2amigos/yii2-leaflet-markercluster-plugin/tags)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/b650377b281497187606d2baf7637a2318797df58960dcea429109414f896e8d/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f32616d69676f732f796969322d6c6561666c65742d6d61726b6572636c75737465722d706c7567696e2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/2amigos/yii2-leaflet-markercluster-plugin)[![Coverage Status](https://camo.githubusercontent.com/38688ae912308c7f1352f894cfeb9e23810a250c6608d3cda12b3cc7a5f9f08b/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f32616d69676f732f796969322d6c6561666c65742d6d61726b6572636c75737465722d706c7567696e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/2amigos/yii2-leaflet-markercluster-plugin/code-structure)[![Quality Score](https://camo.githubusercontent.com/e46a256cd1c9c82efd8d363e8b3b9355e5af5083c17f4ad842b917e7cec57a8e/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f32616d69676f732f796969322d6c6561666c65742d6d61726b6572636c75737465722d706c7567696e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/2amigos/yii2-leaflet-markercluster-plugin)[![Total Downloads](https://camo.githubusercontent.com/c566e40391f269327fc745549bc7573976fb37b2c36a2dbf8e4b50bc2bcfe9d5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f32616d69676f732f796969322d6c6561666c65742d6d61726b6572636c75737465722d706c7567696e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/2amigos/yii2-leaflet-markercluster-plugin)

Yii 2 [LeafletJs](http://leafletjs.com/) Plugin to provide beautiful, sophisticated, high performance marker clustering solution with smooth animations and lots of great features. This Plugin works in conjunction with [LeafLet](https://github.com/2amigos/yii2-leaflet-extension)library for [Yii 2](https://github.com/yiisoft/yii2) framework.

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

[](#installation)

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

Either run

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

```

or add

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

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

Usage
-----

[](#usage)

Using an external json url source:

```
// LeafLet initialization component
// ...

// create cluster plugin
$cluster = new dosamigos\leaflet\plugins\markercluster\MarkerCluster([
     'jsonUrl' =>  Yii::$app->controller->createUrl('site/json')
]);

// install to LeafLet component
$leafLet->plugins->install($cluster);

// done render widget
echo $leafLet->widget(['options' => ['style' => 'height: 400px']]);

```

The example action returning the markers:

```
public function actionJson()
{
    Yii::$app->getResponse()->format = Response::FORMAT_JSON;
    echo json_encode([
        "markers" =>  [
            ["lat"=>-37.8210922667, "lng"=>175.2209316333, "popup" => "2"],
            ["lat"=>-37.8210819833, "lng"=>175.2213903167, "popup" => "3"],

        ]
    ]);
}

```

Now, adding markers as we create them:

```
// LeafLet initialization component
// ...

// create cluster plugin
$cluster = new dosamigos\leaflet\plugins\markercluster\MarkerCluster([
     'jsonUrl' =>  Yii::$app->controller->createUrl('site/json')
]);

// sample location
$center = new dosamigos\leaflet\types\LatLng(['lat' => 51.508, 'lng' => -0.11]);

$marker1 = new dosamigos\leaflet\layers\Marker([
    'latLng' => $center,
    'popupContent' => 'Hey! I am a marker'
]);

$marker2 = new dosamigos\leaflet\layers\Marker([
     'latLng' => $center,
     'popupContent' => 'Hey! I am a second marker'
]);

// add them to the cluster plugin
$cluster
    ->addLayer($marker1)
    ->addLayer($marker2);

// install to LeafLet component
$leafLet->plugins->install($cluster);

```

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

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity64

Established project with proven stability

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

Total

2

Last Release

4060d ago

Major Versions

0.1.0 → 1.0.02015-03-31

### Community

Maintainers

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

---

Tags

pluginyii2extensionwidgetmapsyiileafletyii 22amigos

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

PHPackages © 2026

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