codeat3/blade-phosphor-icons
Use Phosphor Icons in Laravel Blade via simple <x-phosphor-*> components. Built on Blade Icons with support for caching and configurable defaults. Requires PHP 7.4+ and Laravel 8+. Includes v1/v2 Phosphor icon sets and easy upgrades.
Pros:
Cons:
@cache(config('view.cache_ttl'))
@phosphor('users', 'fill', 'currentColor', '2em')
@endcache
@phosphor.@cache).@once directives that might conflict with new caching logic.@cache).Cache-Control headers) or only Blade-level caching?@phosphor($dynamicIcon)) without stale content?@phosphor + @cache and measure:
laravel-debugbar).@cache(['tags' => 'dashboard-icons'], 60)
@phosphor('users', 'fill', 'currentColor', '2em')
@endcache
composer.json to ^2.4.0 and publish the package’s config (if applicable).{{ SVG('user') }} → @phosphor('user')).public/icons/phosphor.svg with Cache-Control: immutable).@-prefixed directives._navbar.blade.php) with @phosphor + @cache.{{ $icon }} → @phosphor($dynamicIcon)) and test caching behavior.@phosphor syntax.@cache could lead to stale content if not managed (e.g., dynamic icons).@phosphor) + caching best practices.@cache vs. HTTP caching").@cache misconfiguration).Cache-Control for SVGs).@cache on highly dynamic icons) or excessive icon usage.@cache selectively (e.g., for static icons in headers/footers).@cache or use short TTLs (e.g., 10 seconds).| Scenario | Impact | Mitigation |
|---|---|---|
| Phosphor CDN down | Icons fail to load | Self-host assets or use local fallback SVGs. |
| Blade cache corruption | Stale icons rendered | Clear cache or use unique cache tags (e.g., ['tags' => 'user-icon']). |
| Package abandonment | No updates for new Phosphor icons | Fork or switch to Laravel Heroicons/Tailwind. |
Overuse of @cache |
Stale dynamic icons | Avoid @cache for dynamic icons; use short TTLs if needed. |
| Vite/Mix misconfiguration | SVGs not optimized | Validate build output with vite build --analyze. |
@phosphor syntax and Phosphor’s icon naming.@cache.```blade
@cache(['tags' => 'dashboard-icons'], 3600) // Cache for 1 hour
@phosphor('users')
@endcache
@php $icon = Auth::user()->role === 'admin' ? 'shield' : 'user'; @end
How can I help you explore Laravel packages today?