PHPackages                             log1x/laravel-webfonts - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. log1x/laravel-webfonts

ActivePackage[Utility &amp; Helpers](/categories/utility)

log1x/laravel-webfonts
======================

Download, install, and preload over 1500 Google fonts locally in your Laravel project

v2.0.1(1y ago)142123.4k↑24.4%7[1 issues](https://github.com/Log1x/laravel-webfonts/issues)1MITPHPPHP &gt;=8.1CI passing

Since Jan 18Pushed 1y ago2 watchersCompare

[ Source](https://github.com/Log1x/laravel-webfonts)[ Packagist](https://packagist.org/packages/log1x/laravel-webfonts)[ GitHub Sponsors](https://github.com/Log1x)[ RSS](/packages/log1x-laravel-webfonts/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (6)Dependencies (6)Versions (7)Used By (1)

Laravel Webfonts
================

[](#laravel-webfonts)

[![Latest Stable Version](https://camo.githubusercontent.com/6d6ff26a7232c64b38d87b59a657766ab441d90e370d709071e94e635b055d66/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c6f6731782f6c61726176656c2d776562666f6e74732e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/6d6ff26a7232c64b38d87b59a657766ab441d90e370d709071e94e635b055d66/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c6f6731782f6c61726176656c2d776562666f6e74732e7376673f7374796c653d666c61742d737175617265)[![Total Downloads](https://camo.githubusercontent.com/a77bc7e02c05542e0b6938799be2f4e5bbaf32112ef8ba00bac414d46c9a957a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c6f6731782f6c61726176656c2d776562666f6e74732e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/a77bc7e02c05542e0b6938799be2f4e5bbaf32112ef8ba00bac414d46c9a957a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c6f6731782f6c61726176656c2d776562666f6e74732e7376673f7374796c653d666c61742d737175617265)[![Build Status](https://camo.githubusercontent.com/5711894cf4a3912e349c611e1e9c1e1883a88fd214a26242021dbcbb44335437/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6c6f6731782f6c61726176656c2d776562666f6e74732f6d61696e2e796d6c3f6272616e63683d6d61696e267374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/5711894cf4a3912e349c611e1e9c1e1883a88fd214a26242021dbcbb44335437/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6c6f6731782f6c61726176656c2d776562666f6e74732f6d61696e2e796d6c3f6272616e63683d6d61696e267374796c653d666c61742d737175617265)

Laravel Webfonts allows you to easily download, install, and preload over 1500 Google fonts locally in your Laravel project.

[![Demo](https://camo.githubusercontent.com/197053633c55db5d4b964924fd1c1ac6c45cd6f2f16b8922bb7dc9d52f308dc8/68747470733a2f2f692e696d6775722e636f6d2f4a676f74794b4b2e676966)](https://camo.githubusercontent.com/197053633c55db5d4b964924fd1c1ac6c45cd6f2f16b8922bb7dc9d52f308dc8/68747470733a2f2f692e696d6775722e636f6d2f4a676f74794b4b2e676966)

Features
--------

[](#features)

- 🔍️ Search and install over 1500 Google fonts from the public [google-webfonts-helper](https://github.com/majodev/google-webfonts-helper) API.
- ⚡️ Automatically generate `@font-face` CSS `at-rules` when installing fonts using CLI.
- 🧑‍💻 Supports [Vite](https://vitejs.dev/) out of the box with zero configuration.
- ⚡️ Provides an easy-to-use `@preloadFonts` Blade directive to preload fonts found in the Vite manifest.
- 🚀 Automatically injects font preload markup into `wp_head` on WordPress sites running [Acorn](https://github.com/roots/acorn).

Requirements
------------

[](#requirements)

- [PHP](https://secure.php.net/manual/en/install.php) &gt;= 8.1
- [Composer](https://getcomposer.org/download/)
- [Laravel](https://github.com/laravel/laravel) &gt;= 10.0

Installation
------------

[](#installation)

Install via Composer:

```
$ composer require log1x/laravel-webfonts
```

Usage
-----

[](#usage)

If you already have fonts locally installed in your project, skip to [Preloading Fonts](#preloading-fonts).

### Adding Fonts

[](#adding-fonts)

Laravel Webfonts provides a very easy way to install new webfonts to your project using command line:

```
artisan webfonts:add
```

By default, installing a font will trigger the following things to happen:

- Download the font archive to a temporary directory in local storage.
- Extract the font archive.
- Move downloaded fonts to `resources/fonts`.
- Clean up the temporary directory.
- Generate and prepend `@font-face` at-rules to a `fonts` stylesheet.

The fonts stylesheet will reside at the root of your stylesheet directory located in `resources/`. If the font stylesheet does not already exist, it will be created using the most common stylesheet extension (css, scss, ...) found among your styles.

By default, the `resources/css` and `resources/styles` directories are automatically scanned for existing files to find the appropriate place to write the fonts stylesheet.

The generated `@font-face` at-rules will look like this:

```
@font-face {
  font-display: swap;
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 400;
  src: url('../fonts/roboto-v30-latin-regular.woff2') format('woff2');
}

@font-face {
  font-display: swap;
  font-family: 'Roboto';
  font-style: italic;
  font-weight: 400;
  src: url('../fonts/roboto-v30-latin-italic.woff2') format('woff2');
}
```

Adding additional fonts will cause them to be prepended to the existing `fonts` stylesheet.

### Importing Fonts

[](#importing-fonts)

When fonts are installed for the first time, a `fonts` stylesheet is created in your project's stylesheet folder. In a vanilla Laravel project, this is typically `resources/css/fonts.css`.

You must import the generated `fonts` file into your project's primary stylesheet (e.g. `app.css`). If you're using Tailwind, it would look something like:

```
@import 'fonts';

@tailwind base;
@tailwind components;
@tailwind utilities;
```

### Preloading Fonts

[](#preloading-fonts)

Note

If you are using WordPress alongside [Acorn](https://github.com/roots/acorn), you can ignore this section as preloading is automatically handled for you inside of `wp_head` if an asset manifest containing valid fonts is detected.

Laravel Webfonts primary functionality while in production is to provide a simple way to preload your locally hosted webfonts.

This is done by reading the compiled `woff2` fonts from your Vite manifest and generating the appropriate markup for you to place inside of ``.

In most cases, you can simply use the `@preloadFonts` Blade directive to handle building and echoing the font preload HTML markup.

Alternatively to the Blade directive, you can access the `PreloadFonts` class directly using the `Webfonts` Facade:

```
use Log1x\LaravelWebfonts\Facades\Webfonts;

// Retrieve an array of compiled font paths.
$fonts = Webfonts::fonts();

// Build the font preload HTML markup.
$html = Webfonts::preload()->build();
```

Allowing/excluding certain fonts from being preloaded can be done inside `register()` of a service provider:

```
use Log1x\LaravelWebfonts\Webfonts;

// Allow specific fonts.
Webfonts::only(['inter-v13-latin-regular']);

// Exclude specific fonts.
Webfonts::except(['inter-v13-latin-500']);
```

Bug Reports
-----------

[](#bug-reports)

If you discover a bug in Laravel Webfonts, please [open an issue](https://github.com/log1x/laravel-webfonts/issues).

Contributing
------------

[](#contributing)

Contributing whether it be through PRs, reporting an issue, or suggesting an idea is encouraged and appreciated.

License
-------

[](#license)

Laravel Webfonts is provided under the [MIT License](LICENSE.md).

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity49

Moderate usage in the ecosystem

Community19

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~81 days

Total

6

Last Release

536d ago

Major Versions

v1.0.3 → v2.0.02025-02-28

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5745907?v=4)[Brandon](/maintainers/Log1x)[@Log1x](https://github.com/Log1x)

---

Top Contributors

[![Log1x](https://avatars.githubusercontent.com/u/5745907?v=4)](https://github.com/Log1x "Log1x (18 commits)")[![tombroucke](https://avatars.githubusercontent.com/u/24292260?v=4)](https://github.com/tombroucke "tombroucke (2 commits)")

---

Tags

acornlaravelwebfonts

###  Code Quality

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/log1x-laravel-webfonts/health.svg)

```
[![Health](https://phpackages.com/badges/log1x-laravel-webfonts/health.svg)](https://phpackages.com/packages/log1x-laravel-webfonts)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.9k556.2M21.5k](/packages/laravel-framework)[statamic/cms

The Statamic CMS Core Package

4.9k3.8M1.2k](/packages/statamic-cms)[drush/drush

Drush is a command line shell and scripting interface for Drupal, a veritable Swiss Army knife designed to make life easier for those of us who spend some of our working hours hacking away at the command prompt.

2.4k61.7M839](/packages/drush-drush)[laravel/boost

Laravel Boost accelerates AI-assisted development by providing the essential context and structure that AI needs to generate high-quality, Laravel-specific code.

3.6k26.0M809](/packages/laravel-boost)[nativephp/mobile

NativePHP for Mobile

1.1k102.1k147](/packages/nativephp-mobile)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k832.6k55](/packages/neuron-core-neuron-ai)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
