pixelrobin/php-feather
Lightweight PHP library for Feather icons. Use IconManager to fetch and render SVGs by name, set global or per-icon attributes (size, color, stroke weight, CSS classes), add accessibility alt text, and define aliases to swap icons across a project easily.
aria-hidden) for WCAG compliance, critical for inclusive design.@feather('user') instead of @feather('user-outline')) improve developer ergonomics.Feather::icon() calls with the new Feather\Icon object (e.g., Feather\Icon::make('user')->withAttributes(['aria-hidden' => 'true'])).// Old: @feather('user')
// New: @feather('user') // (alias support may require custom directive)
title, class) now require object methods.Icon class could surface in production.class FeatherWrapper {
public static function icon(string $name, array $attrs = []): string {
return Feather\Icon::make($name)->withAttributes($attrs)->render();
}
}
laravel-icons if v2.0’s migration overhead is prohibitive.Icon object immediately, or use a wrapper for incremental migration?aria-label) mandatory for compliance? If so, leverage v2.0’s built-in support.withAttributes() method.Icon object in a sandbox (e.g., Feather\Icon::make('user')->render()).// app/Providers/AppServiceProvider.php
Blade::directive('feather', function ($icon) {
return "<?= (new \\Feather\\Icon($icon))->render(); ?>";
});
Usage: @feather('user') (supports aliases).// app/Facades/Feather.php
public static function icon(string $name, array $attrs = []): string {
return (new Feather\Icon($name))->withAttributes($attrs)->render();
}
Usage: <x-feather :name="'user'" :attrs="{'aria-label': 'Profile'}" />.resources/svg/feather/user.svg?title=Profile).laravel-icons if v2.0’s API proves too restrictive.pixelrobin/php-feather:^2.0.IconNotFoundException); handle gracefully.title).Icon object rendering in a non-critical component.withAttributes() for tooltips/classes.composer.json:
"config": {
"preloaded-autoload": true,
"preloaded-classes": "Feather\\Icon"
}
Icon object API (e.g., method chaining).IconNotFoundException.withAttributes()).How can I help you explore Laravel packages today?