# Twig

Twig, the flexible, fast, and secure template language for PHP

Repository: https://github.com/twigphp/Twig
Canonical: https://ross.abutalabs.com/products/twig
Homepage: https://twig.symfony.com/
Language: PHP
License: BSD-3-Clause
License Family: permissive
Topics: twig, php, template-engine, template-language, templating
Last push: 2026-08-26T14:47:15+00:00
Link (homepage): https://twig.symfony.com/
Link (site_page): https://twig.symfony.com/doc/3.x
Link (site_page): https://twig.symfony.com/doc/3.x/intro.html

## Health v2 (maintenance only)
Score: 96/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 99, release rhythm 91, longevity 100
- inputs: {"age_days": 6174, "days_push": 7, "days_rel": 61, "gap_med": 5.0, "n_releases_24m": 7}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 8375, forks 1287 (observed 2026-08-28T04:10:20.577945+00:00)

## What it is
Twig is a fast, secure, and flexible template engine and template language for PHP, inspired by Django and Jinja. It compiles templates to optimized PHP code, supports sandboxing of untrusted templates, and allows custom tags, filters, and DSLs.

## Use cases
- render html templates in a php application
- separate presentation logic from php code
- let users safely edit templates with sandbox mode
- define custom template tags and filters
- build themes for drupal or symfony projects

## When to choose
- you need a mature, secure templating layer for PHP
- you want concise, designer-friendly template syntax with auto-escaping
- you use Symfony, Drupal, or another framework supporting Twig

## When to avoid
- you are not working in PHP
- you prefer plain PHP templates or a JS-based templating stack

## Facets
- artifact type: library
- maturity: stable
- function: templating, web-framework
- domain: web-development, backend, developer-tools
- platform: php, cross-platform
- tags: template-engine, template-language, jinja-inspired, autoescaping, sandbox, symfony, web-server

## Member repositories
- twigphp/Twig (main) score 96
- twigphp/Twig-extensions (plugin) score 10

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:10:20.577945+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:27:32.626120+00:00, confidence not recorded.
  - readme: https://github.com/twigphp/Twig (fetched 2026-08-28T04:10:20.577945+00:00, sha 11ebe5719982)
  - homepage: https://twig.symfony.com/ (fetched 2026-08-29T08:27:26.506151+00:00, sha df46d453821a)
  - site_page: https://twig.symfony.com/doc/3.x (fetched 2026-08-29T08:27:26.511356+00:00, sha 86ad8d1ffe10)
  - site_page: https://twig.symfony.com/doc/3.x/intro.html (fetched 2026-08-29T08:27:26.513250+00:00, sha 2885eb16020a)
- Data as of 2026-08-30T08:39:29.467469+00:00.
