filament/spatie-laravel-google-fonts-plugin
Adds a Spatie Google Fonts provider to Filament panels, letting you use locally fetched and cached Google Fonts via spatie/laravel-google-fonts. Configure with Panel::font('Inter', provider: SpatieGoogleFontProvider::class) to avoid CDNs.
Panel::font()).@googlefonts Blade directive), reducing redundant font-fetching logic in Filament. The plugin acts as a thin wrapper, minimizing custom backend changes.spatie/laravel-google-fonts) and Filament’s core. No database migrations or complex dependencies are introduced.Panel::font(), a Filament-native method, reducing friction for teams already using Filament’s panel system.@googlefonts), which integrate seamlessly with Laravel Mix/Vite if used.spatie/laravel-google-fonts (e.g., storage paths, caching, API keys). Misconfiguration here could break font loading.Inter:wght@100..900).@googlefonts directive is Blade-specific, which could complicate projects using non-Blade templating (e.g., Inertia.js with Vue/React).filament/spatie-laravel-google-fonts-plugin (v5.x) with compatible Filament and Spatie versions (e.g., Filament v3.x+).public/fonts)?Inter, Roboto). Avoid for projects requiring offline-first or self-hosted fonts exclusively.font() with CDN URLs. This plugin reduces CDN dependency but adds caching complexity.spatie/laravel-google-fonts (follow Spatie’s docs)..env and config/google-fonts.php.composer require filament/spatie-laravel-google-fonts-plugin:"^5.0" -W
app/Providers/Filament/PanelProvider.php to use the provider:
->font('Inter', provider: SpatieGoogleFontProvider::class)
storage/app/public/google-fonts.spatie/laravel-google-fonts v3.x+. Avoid mixing with older versions.@googlefonts directive. Projects using server-side rendering (SSR) with Blade will work; SPA setups (e.g., Inertia + Vue) may need additional handling.Inter:wght@400;700).php artisan google-fonts:cache).storage/app/public/google-fonts) and Laravel logs.@googlefonts is used within Filament’s asset pipeline.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Google Fonts API key invalid/expired | Fonts fail to load | Monitor API key validity; set up alerts. |
| Storage permissions issue | Cached fonts inaccessible | Ensure storage/app/public/google-fonts is writable. |
| Spatie package misconfiguration | No fonts rendered | Validate config/google-fonts.php and cache. |
| Blade directive not found | Fonts missing in non-Blade views | Use CDN fallback or custom provider. |
| High font variant count | Storage bloat | Prune unused variants or use S3 caching. |
| Filament/Spatie version conflict | Plugin breaks | Pin versions in composer.json. |
Panel::font(), test in a local Filament panel.Panel::font('Inter') withoutHow can I help you explore Laravel packages today?