PHP code example of ghopper / svg-map
1. Go to this page and download the library: Download ghopper/svg-map 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/ */
ghopper / svg-map example snippets
use ghopper\svgmap\SvgMapWidget;
$file = Yii::getAlias('@ghopper/svgmap/example') . "/russia.json";
$data = file_get_contents($file);
$states = json_decode($data);
...
$this->render('index', ['svgData' => $states]);
echo SvgMapWidget::widget([
'type' => SvgMapWidget::DATA_SOURCE_ARRAY,
'data' => $svgData,
'onClick' => 'customClick',
]);