Download the PHP package smnandre/twigmetrics without Composer
On this page you can find all versions of the php package smnandre/twigmetrics. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download smnandre/twigmetrics
More information about smnandre/twigmetrics
Files in smnandre/twigmetrics
Package twigmetrics
Short Description Twig template analyzer for PHP: structure, style, complexity, and maintainability metrics at a glance
License MIT
Informations about the package twigmetrics
Twig 🌿 Metrics
Analyze your Twig templates and get a clear picture of their most important metrics ---    [](https://github.com/sponsors/smnandre) [!WARNING] TwigMetrics is in active development. Use with caution, and expect things to change quickly.
This project is a melting pot of code or ideas I had while working on various Symfony projects. I'm releasing it as a standalone tool in case it can be useful to others.
Depending on the level of interest and feedback, I have plans to expand it into a more reliable and feature-rich tool.
What it does
TwigMetrics scans a directory of .twig
templates and produces a full report:
- Template overview: number of files, directories, lines, characters
- Code style: average line length, comment ratio, indentation, formatting
- Callables: functions, filters, variables, macros, blocks, tests
- Architecture: includes, extends, embeds, imports, inheritance depth
- Complexity: logical depth, IF/ELSE/LOOP counts, nesting
- Maintainability: large files, high complexity hotspots, risk scores
- Visual output: ASCII tables and gauges directly in your terminal
See examples of each section in the Usage section below.
Installation
Global (soon)
[!TIP] A PHAR release is planned, so you’ll be able to install it globally.
Composer
From source
Usage
To analyze a directory of Twig templates, run:
Twig Metrics
Template Files
Logical Complexity
Twig Callables
Code Style
Architecture
Maintainability
Contributing
Feedback, issues, and pull requests are very welcome!
- Issues: github.com/smnandre/twigmetrics/issues
- Pull Requests: github.com/smnandre/twigmetrics/pulls
License
Twig Metrics is licensed under the MIT License. See the LICENSE file for details.
All versions of twigmetrics with dependencies
symfony/console Version ^7.3 || ^8.0
symfony/finder Version ^7.3 || ^8.0
twig/twig Version ^3.21