PHPackages                             joshualicense/govuk-frontend-twig - 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. joshualicense/govuk-frontend-twig

ActiveLibrary[Templating &amp; Views](/categories/templating)

joshualicense/govuk-frontend-twig
=================================

GOV.UK Frontend Nunjucks templates converted to Twig

v6.1.0(2mo ago)43.4k↓48.3%[1 PRs](https://github.com/JoshuaLicense/govuk-frontend-twig/pulls)MITTwigCI passing

Since Apr 20Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/JoshuaLicense/govuk-frontend-twig)[ Packagist](https://packagist.org/packages/joshualicense/govuk-frontend-twig)[ RSS](/packages/joshualicense-govuk-frontend-twig/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (33)Used By (0)

GOV.UK Frontend Twig
====================

[](#govuk-frontend-twig)

This repository contains a collection of [Twig](https://twig.symfony.com/) macros that generate HTML code compatible with the [GOV.UK Frontend](https://github.com/alphagov/govuk-frontend) design system.

Compatibility
-------------

[](#compatibility)

Refer to the table below to determine which version of GOV.UK Frontend Twig you should use for your targeted version of [GOV.UK Frontend](https://github.com/alphagov/govuk-frontend):

GOV.UK Frontend Twig VersionGOV.UK Frontend Version[v6.1.0](https://github.com/JoshuaLicense/govuk-frontend-twig/releases/tag/v6.1.0)[v6.1.0](https://github.com/alphagov/govuk-frontend/releases/tag/v6.1.0)[v6.0.0](https://github.com/JoshuaLicense/govuk-frontend-twig/releases/tag/v6.0.0)[v6.0.0](https://github.com/alphagov/govuk-frontend/releases/tag/v6.0.0)Older versionsGOV.UK Frontend Twig VersionGOV.UK Frontend Version[v5.14.0](https://github.com/JoshuaLicense/govuk-frontend-twig/releases/tag/v5.14.0)[v5.14.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.14.0)[v5.13.0](https://github.com/JoshuaLicense/govuk-frontend-twig/releases/tag/v5.13.0)[v5.13.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.13.0)[v5.11.0](https://github.com/JoshuaLicense/govuk-frontend-twig/releases/tag/v5.11.0)[v5.12.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.12.0)[v5.11.0](https://github.com/JoshuaLicense/govuk-frontend-twig/releases/tag/v5.11.0)[v5.11.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.11.0)[v5.10.0](https://github.com/JoshuaLicense/govuk-frontend-twig/releases/tag/v5.10.0)[v5.10.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.10.0)[v5.9.0](https://github.com/JoshuaLicense/govuk-frontend-twig/releases/tag/v5.9.0)[v5.9.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.9.0)[v5.8.0](https://github.com/JoshuaLicense/govuk-frontend-twig/releases/tag/v5.8.0)[v5.8.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.8.0)[v5.7.0](https://github.com/JoshuaLicense/govuk-frontend-twig/releases/tag/v5.7.0)[v5.7.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.7.0)[v5.6.0](https://github.com/JoshuaLicense/govuk-frontend-twig/releases/tag/v5.6.0)[v5.6.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.6.0)[v5.5.0](https://github.com/JoshuaLicense/govuk-frontend-twig/releases/tag/v5.5.0)[v5.5.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.5.0)[v5.4.0](https://github.com/JoshuaLicense/govuk-frontend-twig/releases/tag/v5.4.0)[v5.4.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.4.0)[v5.3.0](https://github.com/JoshuaLicense/govuk-frontend-twig/releases/tag/v5.3.0)[v5.3.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.3.0)[v5.2.0](https://github.com/JoshuaLicense/govuk-frontend-twig/releases/tag/v5.2.0)[v5.2.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.2.0)[v5.1.0](https://github.com/JoshuaLicense/govuk-frontend-twig/releases/tag/v5.1.0)[v5.1.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.1.0)[v5.0.0](https://github.com/JoshuaLicense/govuk-frontend-twig/releases/tag/v5.0.0)[v5.0.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.0.0)[v4.7.0](https://github.com/JoshuaLicense/govuk-frontend-twig/releases/tag/v4.7.0)[v4.7.0](https://github.com/alphagov/govuk-frontend/releases/tag/v4.7.0)[v4.6.0](https://github.com/JoshuaLicense/govuk-frontend-twig/releases/tag/v4.6.0)[v4.6.0](https://github.com/alphagov/govuk-frontend/releases/tag/v4.6.0)[v4.5.0](https://github.com/JoshuaLicense/govuk-frontend-twig/releases/tag/v4.5.0)[v4.5.0](https://github.com/alphagov/govuk-frontend/releases/tag/v4.5.0)Note that the versioning of this package will match the major and minor versions of [GOV.UK Frontend](https://github.com/alphagov/govuk-frontend), but patch versions may differ.

Usage
-----

[](#usage)

### Installation

[](#installation)

To use GOV.UK Frontend Twig in your project, install it via [Composer](https://getcomposer.org/):

```
composer require joshualicense/govuk-frontend-twig
```

### Configuration

[](#configuration)

In your PHP code, configure the Twig template loader to include the GOV.UK Frontend Twig macros:

```
use Composer\Autoload\ClassLoader;
use Twig\Loader\FilesystemLoader;

// Optional: get the vendor directory using reflection from any directory.
$reflection = new \ReflectionClass(ClassLoader::class);
$vendorDir = dirname($reflection->getFileName(), 2);

$loader = new FilesystemLoader();
$loader->addPath($vendorDir . '/joshualicense/govuk-frontend-twig/src/templates', 'govuk-frontend-twig');
```

### Usage examples

[](#usage-examples)

Here's an example of how to use a GOV.UK Frontend Twig macro in your Twig template:

```
{% from "@govuk-frontend-twig/components/back-link.html.twig" import govukBackLink %}

{{ govukBackLink({
  text: "Back",
  href: "#"
}) }}
```

Refer to the original [GOV.UK Design System Components](https://design-system.service.gov.uk/components/) for more information on available components and macro options.

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance89

Actively maintained with recent releases

Popularity26

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~57 days

Total

27

Last Release

72d ago

Major Versions

v4.7.2 → v5.0.02023-12-08

v5.14.0 → v6.0.02026-02-18

### Community

Maintainers

![](https://www.gravatar.com/avatar/21e82b7d57bfd1d3999bc86fcbfd103214443b2ccd1eff8e1364a8c7af7bc22a?d=identicon)[joshua.license](/maintainers/joshua.license)

---

Top Contributors

[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (73 commits)")[![JoshuaLicense](https://avatars.githubusercontent.com/u/638172?v=4)](https://github.com/JoshuaLicense "JoshuaLicense (54 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (27 commits)")[![Copilot](https://avatars.githubusercontent.com/in/1143301?v=4)](https://github.com/Copilot "Copilot (1 commits)")

---

Tags

govuk-design-systemgovuk-frontend

### Embed Badge

![Health badge](/badges/joshualicense-govuk-frontend-twig/health.svg)

```
[![Health](https://phpackages.com/badges/joshualicense-govuk-frontend-twig/health.svg)](https://phpackages.com/packages/joshualicense-govuk-frontend-twig)
```

###  Alternatives

[twig/extra-bundle

A Symfony bundle for extra Twig extensions

91492.0M315](/packages/twig-extra-bundle)[twig/intl-extra

A Twig extension for Intl

36763.2M221](/packages/twig-intl-extra)[rcrowe/twigbridge

Adds the power of Twig to Laravel

9105.9M50](/packages/rcrowe-twigbridge)[twig/string-extra

A Twig extension for Symfony String

22046.0M133](/packages/twig-string-extra)[twig/cssinliner-extra

A Twig extension to allow inlining CSS

22918.5M55](/packages/twig-cssinliner-extra)[symfony/ux-twig-component

Twig components for Symfony

21914.8M162](/packages/symfony-ux-twig-component)

PHPackages © 2026

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