FontAwesomeSVG-PHP icon indicating copy to clipboard operation
FontAwesomeSVG-PHP copied to clipboard

Render SVG from `<i></i>` tags

Open husseinalhammad opened this issue 3 years ago • 0 comments

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:

  1. Make it easier to switch to server-rendered SVGs for existing projects that are currently rendering these client-side
  2. Learn one API (the official FA one) instead of two

husseinalhammad avatar Aug 16 '22 14:08 husseinalhammad