$ show spatie/laravel-google-fonts
This is a Laravel package that enables self-hosting of Google Fonts by fetching font CSS and asset files from Google's servers, storing them locally on a configurable filesystem disk, and serving them via Blade directives. The core logic resides in the `GoogleFonts` service class, which handles downloading, caching, and rendering fonts either inline or as external stylesheets with optional preload support. The package provides a fallback mechanism to load fonts directly from Google if local storage fails. It is well-tested with Pest and snapshot assertions, supports a wide range of Laravel versions (8–13) and PHP 8.0+, and follows Spatie's typical high-quality package structure with clean separation of concerns, config-driven behavior, and a dedicated Artisan command for prefetching fonts.
The LLM identified 1 files worth highlighting for reuse:
A self-contained value object that encapsulates the rendering of font HTML (inline style, link tag, or fallback). It implements `Htmlable` and provides methods `inline()`, `link()`, `fallback()`, and `url()`. The class is decoupled from the fetching logic and can be reused in any PHP project that needs to output font-related HTML with configurable attributes (nonce, preload). Its attribute parsing logic is clean and could be extracted as a general utility.