Replies: 1 comment 1 reply
-
|
I don't think this is very feasible to implement while staying framework agnostic, and there are just about a zillion PHP frameworks out there. On the other hand, this feature should be fairly easy to hook into any composer project without too much of a hassle, you just need https://asset-packagist.org/, install function lucideIcon(string $name) {
$path = LUCIDE_ICONS_PATH.DIRECTORY_SEPARATOR.$name.'.svg';
if (!file_exists($path)) {
throw new YourCustomException();
// or return arbitrary "icon not found" markup.
}
$svg = file_get_contents($file);
return new Twig\Markup($svg, 'utf-8');
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Is there a chance we can get a Twig or PHP function?
Something you can install with Composer and then call
lucide('arrow-right', size: 64, color: '#444444', strokeWidth: 1)orLucide::icon(...)in PHP, which returns the icon as a string (<svg ...>...</svg>).A Twig function would be nice but wrapping it yourself is easy enough. And a simple PHP function makes it more versatile.
That would be very helpful for all PHP websites out there.
Beta Was this translation helpful? Give feedback.
All reactions