Skip to content
CAI
Produce a survey ↗Verify a survey

twigphp/Twig

This system is a modernized PHP template engine that provides a modular architecture for rendering and managing templates. It offers a comprehensive suite of extensions for internationalization, string manipulation, HTML/CSS processing, and caching, alongside a robust security model for sandboxed rendering. The codebase has been refact to use PHP 8 attributes for extension registration, generator-based compilation for memory efficiency, and a new expression parser for improved maintainability.

61.1

Adequate · 2 August 2026

24k

lines of production code

PHP

primary language

1

bus factor · 538 authors in all

3

measurements over time

CAI band scale
CAI trend line

How it got here

2009–2019 · Modernization and architectural overhaul

This period was defined by a comprehensive modernization of the Twig template engine, introducing PHP 8 attributes for extension registration and a dedicated sandbox security model. The codebase underwent significant internal refactoring, including a new cache and loader architecture, generator-based template compilation, and enhanced error handling. Additionally, the project expanded its ecosystem with new extra packages for HTML, Markdown, and internationalization support.

56 changes

2021–2024 · Twig 4.0 preparation and extension expansion

This period focused on preparing the codebase for Twig 4.0 by deprecating internal functions and refactoring variable handling, while simultaneously expanding the library's capabilities with new extensions for caching, HTML manipulation, and internationalization. The work also included adding comprehensive test coverage for these new features and updating the documentation build process.

35 changes

2025–2026 · expression parser refactoring

The project focused on refactoring the expression parser into a modular architecture, introducing specialized parsers for prefix and infix expressions to improve maintainability and operator precedence handling. This period also included generating documentation for operator precedence and updating tests for compatibility with PHPUnit 11 and legacy core sandbox enforcement.

6 changes

CAI lens gauges

Survey your own repository

twigphp/Twig was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point the surveyor at a repository you know and see whether you agree with it.

Survey a repository

About this page

  • The description of this project is derived from its own commit history, not from its README.
  • The score is its highest published measurement, taken on 2 August 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 7793b6153f — the exact code this score is about.
  • Scored under rubric rubric-2026.08.18. Score the same commit under that rubric and you get the same number.
CAI link cards