driesvints/blade-icons
Blade Icons lets you use SVG icons in Laravel Blade with simple components and directives. Convert files like camera.svg into or @svg('camera') with easy class/attribute control, and plug in community icon set packages.
class="w-6 h-6"), but flexible enough to work with other CSS frameworks or raw utilities. This reduces friction in projects already using Tailwind.blade-icons:install), followed by minimal Blade configuration.<x-icon-camera />) and directive syntax (@svg('camera')), accommodating teams with varying Blade maturity.resources/svg and register them via config. This avoids vendor lock-in.--only flag during installation to include only necessary icons.@apply or dynamic classes), ensure the cache is invalidated appropriately (e.g., php artisan view:clear).svg_path in config/blade-icons.php could break icon resolution. Validate paths post-installation.<img> tags).composer require blade-ui-kit/blade-icons
php artisan blade-icons:install
--all (all icons, ~1.2MB).--only (custom subset, e.g., --only=heroicons,tabler).<img src="/icons/camera.svg" /> with <x-icon-camera />.@svg('camera', ['class' => $isActive ? 'text-red-500' : 'text-gray-500'])
php artisan optimize:clear to repopulate Blade cache.svg directive in AppServiceProvider.w-4 h-4).// config/blade-icons.php
'sets' => [
'custom' => resource_path('svg/custom'),
];
safelist includes icon classes (e.g., w-6 h-6).<img> tags) in non-critical views (e.g., footer, documentation).composer update and Blade cache clearance. Monitor the changelog for breaking changes.resources/svg directory and config/blade-icons.php for additions/deletions.php artisan view:clear
svg_path in config and file permissions.safelist or use inline styles.<x-icon-camera aria-label="Camera" />).| Failure Scenario | Impact | Mitigation |
|---|---|---|
Misconfigured svg_path |
Icons fail to render | Validate paths post-install; use --dry-run. |
| Blade cache corruption | Stale icon components | Clear cache (php artisan view:clear). |
| Overuse of inline SVGs | Increased template size | Use --only flag; lazy-load non-critical icons. |
| Custom icon path errors | Broken custom icons | Test custom icon registration in staging. |
| Laravel version incompatibility | Package fails to load | Pin version in composer.json (e.g., ^4.0). |
How can I help you explore Laravel packages today?