PHP code example of dominus77 / yii2-svg-widget
1. Go to this page and download the library: Download dominus77/yii2-svg-widget 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/ */
dominus77 / yii2-svg-widget example snippets
php composer.phar
<div id="drawing"></div>
\dominus77\svg\SvgWidget::widget([
'elementId' => 'drawing',
'clientScript' => new \yii\web\JsExpression("
draw.rect(100, 100).move(100, 50).fill('#f06');
"),
]);
$fileName = 'russia'; // russia or world
$file = Yii::getAlias('@dominus77/svg/example') . "/" . $fileName . ".json";
$data = file_get_contents($file);