{"id":15637084,"url":"https://github.com/log1x/laravel-webfonts","last_synced_at":"2025-05-16T12:10:19.440Z","repository":{"id":217813316,"uuid":"744868429","full_name":"Log1x/laravel-webfonts","owner":"Log1x","description":"Download, install, and preload Google fonts locally in your Laravel project.","archived":false,"fork":false,"pushed_at":"2025-02-28T20:07:40.000Z","size":34,"stargazers_count":129,"open_issues_count":1,"forks_count":7,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-05-14T08:42:05.611Z","etag":null,"topics":["acorn","laravel","webfonts"],"latest_commit_sha":null,"homepage":"https://github.com/Log1x/laravel-webfonts","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Log1x.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"Log1x"}},"created_at":"2024-01-18T07:02:42.000Z","updated_at":"2025-05-13T09:44:28.000Z","dependencies_parsed_at":"2024-01-18T11:27:20.715Z","dependency_job_id":"6f0c150f-bf7d-4751-9c36-a825fcfe8104","html_url":"https://github.com/Log1x/laravel-webfonts","commit_stats":{"total_commits":11,"total_committers":2,"mean_commits":5.5,"dds":"0.18181818181818177","last_synced_commit":"0d38122aa7f5501394006a6715f7d97dac223507"},"previous_names":["log1x/laravel-webfonts"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Log1x%2Flaravel-webfonts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Log1x%2Flaravel-webfonts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Log1x%2Flaravel-webfonts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Log1x%2Flaravel-webfonts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Log1x","download_url":"https://codeload.github.com/Log1x/laravel-webfonts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254527100,"owners_count":22085919,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["acorn","laravel","webfonts"],"created_at":"2024-10-03T11:09:52.857Z","updated_at":"2025-05-16T12:10:19.372Z","avatar_url":"https://github.com/Log1x.png","language":"PHP","funding_links":["https://github.com/sponsors/Log1x"],"categories":[],"sub_categories":[],"readme":"# Laravel Webfonts\n\n![Latest Stable Version](https://img.shields.io/packagist/v/log1x/laravel-webfonts.svg?style=flat-square)\n![Total Downloads](https://img.shields.io/packagist/dt/log1x/laravel-webfonts.svg?style=flat-square)\n![Build Status](https://img.shields.io/github/actions/workflow/status/log1x/laravel-webfonts/main.yml?branch=main\u0026style=flat-square)\n\nLaravel Webfonts allows you to easily download, install, and preload over 1500 Google fonts locally in your Laravel project.\n\n![Demo](https://i.imgur.com/JgotyKK.gif)\n\n## Features\n\n- 🔍️ Search and install over 1500 Google fonts from the public [google-webfonts-helper](https://github.com/majodev/google-webfonts-helper) API.\n- ⚡️ Automatically generate `@font-face` CSS `at-rules` when installing fonts using CLI.\n- 🧑‍💻 Supports [Vite](https://vitejs.dev/) out of the box with zero configuration.\n- ⚡️ Provides an easy-to-use `@preloadFonts` Blade directive to preload fonts found in the Vite manifest.\n- 🚀 Automatically injects font preload markup into `wp_head` on WordPress sites running [Acorn](https://github.com/roots/acorn).\n\n## Requirements\n\n- [PHP](https://secure.php.net/manual/en/install.php) \u003e= 8.1\n- [Composer](https://getcomposer.org/download/)\n- [Laravel](https://github.com/laravel/laravel) \u003e= 10.0\n\n## Installation\n\nInstall via Composer:\n\n```sh\n$ composer require log1x/laravel-webfonts\n```\n\n## Usage\n\nIf you already have fonts locally installed in your project, skip to [Preloading Fonts](#preloading-fonts).\n\n### Adding Fonts\n\nLaravel Webfonts provides a very easy way to install new webfonts to your project using command line:\n\n```sh\nartisan webfonts:add\n```\n\nBy default, installing a font will trigger the following things to happen:\n\n- Download the font archive to a temporary directory in local storage.\n- Extract the font archive.\n- Move downloaded fonts to `resources/fonts`.\n- Clean up the temporary directory.\n- Generate and prepend `@font-face` at-rules to a `fonts` stylesheet.\n\nThe 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.\n\nBy default, the `resources/css` and `resources/styles` directories are automatically scanned for existing files to find the appropriate place to write the fonts stylesheet.\n\nThe generated `@font-face` at-rules will look like this:\n\n```css\n@font-face {\n  font-display: swap;\n  font-family: 'Roboto';\n  font-style: normal;\n  font-weight: 400;\n  src: url('../fonts/roboto-v30-latin-regular.woff2') format('woff2');\n}\n\n@font-face {\n  font-display: swap;\n  font-family: 'Roboto';\n  font-style: italic;\n  font-weight: 400;\n  src: url('../fonts/roboto-v30-latin-italic.woff2') format('woff2');\n}\n```\n\nAdding additional fonts will cause them to be prepended to the existing `fonts` stylesheet.\n\n### Importing Fonts\n\nWhen 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`.\n\nYou 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:\n\n```css\n@import 'fonts';\n\n@tailwind base;\n@tailwind components;\n@tailwind utilities;\n```\n\n### Preloading Fonts\n\n\u003e [!NOTE]\n\u003e 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.\n\nLaravel Webfonts primary functionality while in production is to provide a simple way to preload your locally hosted webfonts.\n\nThis is done by reading the compiled `woff2` fonts from your Vite manifest and generating the appropriate markup for you to place inside of `\u003chead\u003e`.\n\nIn most cases, you can simply use the `@preloadFonts` Blade directive to handle building and echoing the font preload HTML markup.\n\nAlternatively to the Blade directive, you can access the `PreloadFonts` class directly using the `Webfonts` Facade:\n\n```php\nuse Log1x\\LaravelWebfonts\\Facades\\Webfonts;\n\n// Retrieve an array of compiled font paths.\n$fonts = Webfonts::fonts();\n\n// Build the font preload HTML markup.\n$html = Webfonts::preload()-\u003ebuild();\n```\n\nAllowing/excluding certain fonts from being preloaded can be done inside `register()` of a service provider:\n\n```php\nuse Log1x\\LaravelWebfonts\\Webfonts;\n\n// Allow specific fonts.\nWebfonts::only(['inter-v13-latin-regular']);\n\n// Exclude specific fonts.\nWebfonts::except(['inter-v13-latin-500']);\n```\n\n## Bug Reports\n\nIf you discover a bug in Laravel Webfonts, please [open an issue](https://github.com/log1x/laravel-webfonts/issues).\n\n## Contributing\n\nContributing whether it be through PRs, reporting an issue, or suggesting an idea is encouraged and appreciated.\n\n## License\n\nLaravel Webfonts is provided under the [MIT License](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flog1x%2Flaravel-webfonts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flog1x%2Flaravel-webfonts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flog1x%2Flaravel-webfonts/lists"}