1. Go to this page and download the library: Download vierwd/svg-inliner 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/ */
vierwd / svg-inliner example snippets
$svgInliner = new SvgInliner($defaultOptions);
// render a single SVG file and output a <use>-tag
$output = $svgInliner->renderSVGFile($pathToSvgFile, $options);
// render all SVGs which are references by <use>-tags
$allSVGs = $svgInliner->renderFullSVG();
// render a single SVG and output directly
$output = $svgInliner->renderSVGFile($pathToSvgFile, ['excludeFromConcatenation' => true]);
$svgInliner = new SvgInliner($defaultOptions);
// render a single SVG file and output a <use>-tag with an external file
$output = $svgInliner->renderSVGFile($pathToSvgFile, [
'external' => true,
'url' => '/static/test.svg',
]);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.