2017 © Pedro Peláez
 

yii2-extension yii2-leaflet-extension

LeafLet Mobile-Friendly Interactive Maps Extension Library for Yii2.

image

2amigos/yii2-leaflet-extension

LeafLet Mobile-Friendly Interactive Maps Extension Library for Yii2.

  • Wednesday, April 12, 2017
  • by tonydspaniard
  • Repository
  • 15 Watchers
  • 16 Stars
  • 21,157 Installations
  • PHP
  • 8 Dependents
  • 0 Suggesters
  • 16 Forks
  • 5 Open issues
  • 10 Versions
  • 7 % Grown

The README.md

LeafLet Extension for Yii2

Latest Version Software License Build Status Coverage Status Total Downloads, (*1)

Extension library to display interactive maps with LeafletJs, (*2)

Installation

The preferred way to install this extension is through composer. This requires the composer-asset-plugin, which is also a dependency for yii2 – so if you have yii2 installed, you are most likely already set., (*3)

Either run, (*4)

composer require 2amigos/yii2-leaflet-extension:~1.0

or add, (*5)

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

to the require section of your application's composer.json file., (*6)

Usage

One of the things to take into account when working with LeafletJs 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., (*7)

The following example, is making use of MapQuest:, (*8)

// 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 <a href="http://www.mapquest.com/" target="_blank">MapQuest</a> ' .
        '<img src="http://developer.mapquest.com/content/osm/mq_logo.png">, ' .
        'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>',
        '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

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):, (*9)

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

Once all required libraries are installed then do:, (*10)

$ vendor/bin/phpunit

Further Information

For further information regarding the multiple settings of LeafLetJS library please visit its API reference, (*11)

Contributing

Please see CONTRIBUTING for details., (*12)

Credits

License

The BSD License (BSD). Please see License File for more information., (*13)

2amigOS!
Web development has never been so fun!
www.2amigos.us, (*14)

The Versions

12/04 2017

dev-master

9999999-dev http://yiiwheels.com/extension/leaflet-extension-library

LeafLet Mobile-Friendly Interactive Maps Extension Library for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

extension yii2 2amigos yii maps widget leaflet

26/03 2017

1.1.0

1.1.0.0 http://yiiwheels.com/extension/leaflet-extension-library

LeafLet Mobile-Friendly Interactive Maps Extension Library for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

extension yii2 2amigos yii maps widget leaflet

06/12 2016

1.0.3

1.0.3.0 http://yiiwheels.com/extension/leaflet-extension-library

LeafLet Mobile-Friendly Interactive Maps Extension Library for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

extension yii2 2amigos yii maps widget leaflet

06/02 2016

1.0.2

1.0.2.0 http://yiiwheels.com/extension/leaflet-extension-library

LeafLet Mobile-Friendly Interactive Maps Extension Library for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

extension yii2 2amigos yii maps widget leaflet

21/12 2015

1.0.1

1.0.1.0 http://yiiwheels.com/extension/leaflet-extension-library

LeafLet Mobile-Friendly Interactive Maps Extension Library for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

extension yii2 2amigos yii maps widget leaflet

28/03 2015

1.0.0

1.0.0.0

LeafLet Mobile-Friendly Interactive Maps Extension Library for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

extension yii2 2amigos yii maps widget leaflet

22/01 2015

0.1.3

0.1.3.0

LeafLet Mobile-Friendly Interactive Maps Extension Library for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii maps widget leaflet

22/04 2014

0.1.2

0.1.2.0

LeafLet Mobile-Friendly Interactive Maps Extension Library for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii maps widget leaflet

22/04 2014

0.1.1

0.1.1.0

LeafLet Mobile-Friendly Interactive Maps Extension Library for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii maps widget leaflet

20/04 2014

0.1.0

0.1.0.0

LeafLet Mobile-Friendly Interactive Maps Extension Library for Yii2.

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii maps widget leaflet