Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Google Fonts Laravel Package

spatie/laravel-google-fonts

Self-host Google Fonts in Laravel with minimal setup. Register Google Fonts CSS URLs in config and load them via the @googlefonts Blade directive. On first request it downloads CSS/assets, caches locally, inlines CSS, and falls back to Google if needed.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Performance Optimization: Reduces external dependencies by self-hosting Google Fonts, eliminating DNS lookups and third-party requests, improving page load times (critical for SEO and user experience).
  • Privacy Compliance: Aligns with GDPR/CCPA by avoiding external font tracking (e.g., Google Analytics integration risks) and reducing reliance on third-party domains.
  • Offline/CDN Readiness: Enables seamless integration with CDNs (e.g., Cloudflare, AWS CloudFront) or offline-first deployments by storing fonts locally.
  • Design System Scalability: Centralizes font management in Laravel’s config, making it easier to enforce brand consistency across micro-services or multi-tenant apps.
  • Build vs. Buy: Buy—avoids reinventing wheel for font caching/preloading logic; Build only if needing custom font processing (e.g., dynamic font generation).
  • Roadmap Priorities:
    • Phase 1: Migrate high-traffic pages to self-hosted fonts (e.g., landing pages, dashboards).
    • Phase 2: Extend to all static assets (e.g., emails, PDFs via Laravel Snappy).
    • Phase 3: Integrate with feature flags to A/B test font performance vs. external loading.

When to Consider This Package

Adopt if:

  • Your app uses Google Fonts and suffers from:
    • Slow Lighthouse/PageSpeed scores (e.g., "Reduce third-party usage" warnings).
    • Privacy concerns (e.g., user tracking via Google’s domain).
    • High traffic costs (e.g., CDN bandwidth for external fonts).
  • You’re on Laravel 9+ and need a zero-config solution for font self-hosting.
  • Your team prioritizes maintainability over custom scripts (e.g., manual font downloads).

Look elsewhere if:

  • You need dynamic font generation (e.g., user-uploaded fonts) → Use a package like spatie/laravel-font-lib.
  • Your app targets legacy browsers (e.g., IE11) → Configure custom user-agent strings or use a polyfill.
  • You’re not on Laravel → Use a frontend tool like Fontsource or Webpack plugins.
  • You require advanced caching (e.g., edge caching with Cloudflare Workers) → Build a custom solution or combine with spatie/laravel-caching.

How to Pitch It (Stakeholders)

For Executives: "This package lets us self-host Google Fonts in Laravel with one command, cutting external requests by 30%+ and improving page load times—critical for SEO and user retention. It’s a low-risk, high-reward move: no dev overhead, just faster, more private, and more reliable typography. Competitors like [Company X] are already doing this; we can too, without rewriting our stack."

Key Metrics to Track:

  • Performance: 10–30% faster FCP (First Contentful Paint) post-migration.
  • Cost: Reduced CDN bandwidth for font files.
  • Privacy: Zero third-party font tracking.

For Engineering: *"This is a drop-in replacement for Google Fonts embeds. Here’s how it works:

  1. Configure: Add font URLs to config/google-fonts.php (e.g., Inter, IBM Plex Mono).
  2. Use: Replace <link> tags with @googlefonts Blade directives.
  3. Deploy: Run php artisan google-fonts:fetch to cache fonts locally.
  4. Profit: Fonts load inline (no extra HTTP requests) or via preload tags for critical paths.

Why this over DIY?

  • Handles font scraping, storage, and CSS inlining automatically.
  • Fallbacks to Google if caching fails (no breaking changes).
  • CDN-ready: Store fonts on s3 or public disk and symlink via storage:link.
  • Laravel-native: Works with CSP (via nonce option) and Artisan commands.

Migration Plan:

  1. Pilot: Test on a non-critical route (e.g., /about).
  2. Measure: Compare Lighthouse scores before/after.
  3. Rollout: Phase by traffic tier (e.g., blogs → dashboards).
  4. Monitor: Alert on font-fetch failures (e.g., fallback mode triggered).

Dependencies:

  • Laravel 9+ (tested up to v13).
  • PHP 8.0+.
  • Storage disk (default: public)."*
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai