PHPackages                             neuralglitch/google-fonts - 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. [Templating &amp; Views](/categories/templating)
4. /
5. neuralglitch/google-fonts

ActiveSymfony-bundle[Templating &amp; Views](/categories/templating)

neuralglitch/google-fonts
=========================

Google Fonts integration for Symfony with development CDN and production font locking

0.2.0(6mo ago)6289↑75%MITPHPPHP &gt;=8.1CI passing

Since Nov 2Pushed 6mo agoCompare

[ Source](https://github.com/neuralglitch/google-fonts)[ Packagist](https://packagist.org/packages/neuralglitch/google-fonts)[ Docs](https://github.com/neuralglitch/google-fonts)[ RSS](/packages/neuralglitch-google-fonts/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (19)Versions (4)Used By (0)

Google Fonts
============

[](#google-fonts)

### Google Fonts integration for Symfony

[](#google-fonts-integration-for-symfony)

[![PHP Version](https://camo.githubusercontent.com/b7305b055afbd775305e6192889d355653455a31848f6ae3446e6b5ef205659d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312b2d3737374242343f7374796c653d666c6174266c6f676f3d706870266c6f676f436f6c6f723d7768697465)](composer.json)[![Symfony](https://camo.githubusercontent.com/e9a98c31464d231765804f4fdc323f1c325b9a442e4be9a58455e5b5537fdce5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d362e342b2d3334333433343f7374796c653d666c6174266c6f676f3d73796d666f6e79266c6f676f436f6c6f723d7768697465)](composer.json)
[![PHPUnit](https://github.com/neuralglitch/google-fonts/actions/workflows/phpunit.yml/badge.svg)](https://github.com/neuralglitch/google-fonts/actions/workflows/phpunit.yml)[![Coverage](https://github.com/neuralglitch/google-fonts/actions/workflows/coverage.yml/badge.svg)](https://github.com/neuralglitch/google-fonts/actions/workflows/coverage.yml)[![PHPStan](https://github.com/neuralglitch/google-fonts/actions/workflows/phpstan.yml/badge.svg)](https://github.com/neuralglitch/google-fonts/actions/workflows/phpstan.yml)
[![Psalm](https://github.com/neuralglitch/google-fonts/actions/workflows/psalm.yml/badge.svg)](https://github.com/neuralglitch/google-fonts/actions/workflows/psalm.yml)[![Infection](https://github.com/neuralglitch/google-fonts/actions/workflows/infection.yml/badge.svg)](https://github.com/neuralglitch/google-fonts/actions/workflows/infection.yml)[![Code Style](https://github.com/neuralglitch/google-fonts/actions/workflows/php-cs-fixer.yml/badge.svg)](https://github.com/neuralglitch/google-fonts/actions/workflows/php-cs-fixer.yml)
[![Release](https://camo.githubusercontent.com/264a973f896f912d675fb506c922f91fedd5a888a99b229842545cae616a6ed0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e657572616c676c697463682f676f6f676c652d666f6e74732e7376673f7374796c653d666c6174266c6f676f3d7061636b6167697374266c6f676f436f6c6f723d7768697465)](https://packagist.org/packages/neuralglitch/google-fonts)[![Downloads](https://camo.githubusercontent.com/8d9fbb48617385d83ee7a0d54b20eaa762071f6e265c8ce5201cc4c8e7a34de4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e657572616c676c697463682f676f6f676c652d666f6e74732e7376673f7374796c653d666c6174266c6f676f3d7061636b6167697374266c6f676f436f6c6f723d7768697465)](https://packagist.org/packages/neuralglitch/google-fonts)[![License](https://camo.githubusercontent.com/f48f8d6cf609f5b181b9c3218a85175fe8a5809c7ea400347f39697a5d55065d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c6174)](LICENSE)

Features
--------

[](#features)

- **Twig Function** - Simple `{{ google_fonts() }}` function
- **Development Mode** - Google Fonts CDN with inline styles
- **Production Mode** - Lock fonts locally for better performance and privacy
- **Smart CSS** - Automatic font styling for body, headings, and bold text
- **CLI Tools** - Search, import, lock, and warm-cache commands
- **High Performance** - Optimized with full template caching support

Prerequisites
-------------

[](#prerequisites)

For fully automatic setup, visit the [related Flex recipe repository](https://github.com/neuralglitch/symfony-recipes) and follow the instructions to add it to the composer.json in the consuming project, as the recipe is not yet part of the Symfony’s main recipe repository.

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

[](#installation)

```
composer require neuralglitch/google-fonts
```

Quick Start
-----------

[](#quick-start)

### 1. Add fonts to your template

[](#1-add-fonts-to-your-template)

```
{# templates/base.html.twig #}

  {# Normal font for body and headings #}
  {{ google_fonts('Ubuntu', '300 400 500 700', 'normal italic') }}

  {# Monospace font for code elements #}
  {{ google_fonts('JetBrains Mono', '400 500', 'normal', null, true) }}

```

### 2. Lock fonts for production

[](#2-lock-fonts-for-production)

```
php bin/console gfonts:lock
```

This downloads fonts to `assets/fonts/` (served by AssetMapper in dev, compiled to `public/` in prod).

Each font gets a single CSS file containing both `@font-face` declarations and intelligent styling rules.

The bundle automatically switches to locked fonts in production (via `when@prod` configuration).

**Troubleshooting:** If locked fonts aren't being used in production, see the [Production Setup](docs/production.md) guide.

### 3. Optional: Configure API key for search/import commands

[](#3-optional-configure-api-key-for-searchimport-commands)

```
# .env.local
GOOGLE_FONTS_API_KEY=your_api_key_here
```

Get your free API key at [Google Cloud Console](https://console.cloud.google.com/apis/credentials).

**Note**: The API key is only required for `gfonts:search` and `gfonts:import` commands. The `google_fonts()` Twig function and `gfonts:lock` command do NOT require an API key.

Documentation
-------------

[](#documentation)

- **[Usage Guide](docs/usage.md)** - Detailed examples and function parameters
- **[Commands](docs/commands.md)** - CLI command reference
- **[Configuration](docs/configuration.md)** - Configuration options
- **[Production Setup](docs/production.md)** - Deploying with locked fonts
- **[Development](docs/development.md)** - Contributing and testing

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

[](#requirements)

- PHP 8.1 or higher
- Symfony 6.4, 7.x, or 8.x
- Twig 3.0 or higher

Support
-------

[](#support)

- [GitHub Issues](https://github.com/neuralglitch/google-fonts/issues)
- [Security](.github/SECURITY.md)
- [Contributing](CONTRIBUTING.md)

License
-------

[](#license)

[MIT](LICENSE)

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance68

Regular maintenance activity

Popularity20

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

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 ~2 days

Total

2

Last Release

194d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/af2b1adb15c0785db3d7bb43476f91c5f7fb105890b52e32b303f66623471931?d=identicon)[neuralglitch](/maintainers/neuralglitch)

---

Tags

asset-mappergoogle-fontssymfonysymfony-bundlesymfonytwigSymfony Bundletypographygoogle fontsasset-mapperfonts

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/neuralglitch-google-fonts/health.svg)

```
[![Health](https://phpackages.com/badges/neuralglitch-google-fonts/health.svg)](https://phpackages.com/packages/neuralglitch-google-fonts)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[simplesamlphp/simplesamlphp

A PHP implementation of a SAML 2.0 service provider and identity provider.

1.1k12.4M193](/packages/simplesamlphp-simplesamlphp)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)

PHPackages © 2026

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