SvgInline

SvgInline

Inline SVG file manipulation

Font Awesome Icons

Provides simple functions to add Font Awesome Icons inline. Depends on SvgInline.

echo $svg->fai('hands-wash')->title('Wash your hands');
echo $svg->fai('github', 'brands')->title('GitHub');
Create an issue

Configure Font Awesome Icons behavior in config/params.php under the 'yiirocks/svg-inline-fontawesome' key:

fallbackIcon string
'@vendor/fortawesome/font-awesome/svgs/solid/question.svg'
Default icon to use when the requested icon is unavailable.
fill string
'currentColor'
Default SVG fill color.
fixedWidth bool
false
Default fixed-width icon rendering.
fontAwesomeFolder string
'@vendor/fortawesome/font-awesome/svgs'
Path to the Font Awesome SVGs directory.
prefix string
'svg-inline--fa'
CSS class prefix for inline SVGs.
registerAssets bool
true
Register Yii assets for Font Awesome.
style string
'solid'
Default icon style variant.
fai string [, string]
Name required; style 'solid'
Valid name and style (optional) of a Font Awesome Icon.

Additional options can be chained onto the fai() call:

class string
null
Additional custom classes.
css array
null
Additional CSS attributes.
fill string
'currentColor'
Color of the icon.
fixedWidth bool
false
Set to true to have a fixed width icon.
height int
null
The height of the icon. If height is given without width, the latter will be calculated from the SVG size.
id string
null
Id for the SVG tag.
title string
null
Sets a title to the SVG output. Defaults to the icon name, capitalized.
width int
null
The width of the icon. If width is given without height, the latter will be calculated from the SVG size.