PHP code example of forup / easy-leaflet

1. Go to this page and download the library: Download forup/easy-leaflet 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/ */

    

forup / easy-leaflet example snippets


use Forup\EasyLeaflet\Icon;
use Forup\EasyLeaflet\LatLng;
use Forup\EasyLeaflet\Map;
use Forup\EasyLeaflet\Marker;
use Forup\EasyLeaflet\Popup;
use Forup\EasyLeaflet\TileLayer;

$icon = Icon::centerBottom('/img/pin.png', 32, 40);

$map = Map::create()
    ->setTileLayer(TileLayer::openStreetMap())
    ->addMarker(new Marker(new LatLng(49.5905, 17.1978), $icon, Popup::text('Kojetín HQ')))
    ->addMarker(new Marker(new LatLng(49.1951, 16.6068), $icon, Popup::text('Brno branch')));

echo $map->render();

Map::create()
    ->addMarker(new Marker(new LatLng(49.5905, 17.1978)))
    ->addMarker(new Marker(new LatLng(49.1951, 16.6068)))
    ->setMaxZoom(10);

use Forup\EasyLeaflet\Assets;

echo (new Assets('/js/easy-leaflet.js'))->render();

TileLayer::openStreetMap(); // default
TileLayer::cartoVoyager();
TileLayer::cartoLight();
TileLayer::cartoDark();
TileLayer::mapyCz($apiKey);