PHPackages                             davidjeddy/yii2-leaflet-draw-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. davidjeddy/yii2-leaflet-draw-plugin

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

davidjeddy/yii2-leaflet-draw-plugin
===================================

Plugin for the 2amigo Leaflet extension that adds the Leaflet.Draw functionality.

0.1.0(10y ago)0838—0%3BSD-3-ClausePHPCI failing

Since Sep 23Pushed 10y agoCompare

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

READMEChangelogDependencies (3)Versions (8)Used By (0)

Leaflet Draw Plugin
===================

[](#leaflet-draw-plugin)

Yii 2 [LeafletJs](http://leafletjs.com/) Plugin for the 2amigo Leaflet extension that adds the [Leaflet Draw](https://github.com/Leaflet/Leaflet.draw) functionality.

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

```
php composer.phar require "davidjeddy/yii2-leaflet-draw-plugin" "*"

```

or add

```
"davidjeddy/yii2-leaflet-draw-plugin" : "*"
```

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

Usage
-----

[](#usage)

```
    // 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'  => '1234',
        ]
    ]);

    // now our component and we are going to configure it
    $leaflet = new \dosamigos\leaflet\LeafLet([
        'center' => $center, // set the center
    ]);

	// init the 2amigos leaflet plugin provided by the package
    $drawFeature = new \davidjeddy\leaflet\plugins\draw\Draw();
	// optional config array for leadlet.draw
    $drawFeature->options = [
        "position" => "topright",
        "draw" => [
            "polyline" => [
                "shapeOptions" => [
                    "color" => "#ff0000",
                    "weight" => 10
                ]
            ],
            "polygon" => [
                "allowIntersection" => false, // Restricts shapes to simple polygons
                "drawError" => [
                    "color" => "#e1e100", // Color the shape will turn when intersects
                    "message" => "Oh snap! you can't draw that!" // Message that will show when intersect
                ],
                "shapeOptions" => [
                    "color" => "#bada55"
                ]
            ],
            "circle" => true, // Turns off this drawing tool
            "rectangle" => [
                "shapeOptions" => [
                    "clickable" => false
                ]
            ]
        ]
    ];

    // Different layers can be added to our map using the `addLayer` function.
    $leaflet->addLayer($marker)             // add the marker
            ->addLayer($tileLayer)          // add the tile layer
            ->installPlugin($drawFeature);  // add draw plugin

    // we could also do
    echo $leaflet->widget(['options' => ['style' => 'min-height: 300px']]);
```

Testing
-------

[](#testing)

```
TODO
```

Todo
----

[](#todo)

ADD `edit` menu ability ADD custom marker functionality

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

[](#contributing)

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

Credits
-------

[](#credits)

- [David J Eddy](https://github.com/davidjeddy/)
- [Antonio Ramirez](https://github.com/tonydspaniard)
- [All Contributors](./docs/CONTRIBUTING.md)

License
-------

[](#license)

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

Special Thanks
--------------

[](#special-thanks)

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

> ()
> *Sourcetoad is an award winning app development firm based in Tampa, FL. We are specialists in cross-platform web and mobile application development.*
>

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

3

Last Release

3888d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0c87b153a146e26efc71045db2c227c6eb3a8b2e3b1eb29884491fa550300cf5?d=identicon)[davidjeddy](/maintainers/davidjeddy)

---

Top Contributors

[![davidjeddy](https://avatars.githubusercontent.com/u/6232455?v=4)](https://github.com/davidjeddy "davidjeddy (36 commits)")

---

Tags

pluginyii2extensionwidgetmapsyiiiconleafletyii 2davidjeddy

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/davidjeddy-yii2-leaflet-draw-plugin/health.svg)

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

PHPackages © 2026

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