FontAwesomeSVG-PHP
FontAwesomeSVG-PHP copied to clipboard
Render SVG from `<i></i>` tags
The get_svg() method tasks 2 arguments: a string representing the FA classes and an array of options. This is great and could work for many people. However, I wonder if it is worth adding another method to parse <i></i> tags:
$FA->render('<i class="fa-solid fa-user"></i>');
$FA->render('<i class="fa-duotone fa-camera fa-swap-opacity"></i>');
Or perhaps the same get_svg() function could accept <i></i> tags too?
$FA->get_svg('<i class="fa-solid fa-user"></i>');
$FA->get_svg('<i class="fa-duotone fa-camera fa-swap-opacity"></i>');
The motivation for this would be:
- Make it easier to switch to server-rendered SVGs for existing projects that are currently rendering these client-side
- Learn one API (the official FA one) instead of two