PHP code example of yankovskiy / yii2-leaflet-polyline-measure-plugin

1. Go to this page and download the library: Download yankovskiy/yii2-leaflet-polyline-measure-plugin library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

yankovskiy / yii2-leaflet-polyline-measure-plugin example snippets


$center = new dosamigos\leaflet\types\LatLng(['lat' => 43.105620, 'lng' => 131.873530]);

$osmLayer = new \dosamigos\leaflet\layers\TileLayer([
    'urlTemplate' => 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
    'clientOptions' => [
        'attribution' => '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
    ],
]);

$polylineMeasure = new \neverdark\leaflet\PolylineMeasure();

$leaflet = new \dosamigos\leaflet\LeafLet([
    'center' => $center, // set the center
]);

$leaflet->addLayer($osmLayer);
$leaflet->installPlugin($polylineMeasure);


echo \dosamigos\leaflet\widgets\Map::widget(['height' => '700px', 'leafLet' => $leaflet]);

php composer.phar