Svg

A simple wrapper for SVG extraction.

 class Winter\Storm\Support\Svg

Under the hood, this uses the "svg-sanitizer" library by Daryll Doyle (https://github.com/darylldoyle/svg-sanitizer) to sanitize and/or extract the SVG for usage within Winter.

Methods

public static extract (string $path, boolean $minify = true) : string

Extracts and sanitizes SVG code from a given file.

Parameters
Property Description
$path
string

The path to the SVG file.

$minify
boolean

Whether to minify the extracted SVG code.

Returns
string

protected static sanitize (string $svg, boolean $minify = true) : string

Sanitizes SVG code.

See https://github.com/darylldoyle/svg-sanitizer for usage of the underlying sanitization library.

Parameters
Property Description
$svg
string

SVG code.

$minify
boolean

Whether to minify the given SVG code.

Returns
string
Copyright © 2024 Winter CMS