Nette X-Ray
X-Ray shows you exactly how your project uses the Nette ecosystem: which methods, Latte filters and configuration keys you actually use.
Ever wondered which Nette methods you call the most? Which Latte filters you actually use? Whether anyone still touches that old configuration key? X-Ray scans your code with static analysis and answers that with a clear HTML report.
What Gets Analyzed
Instead of regex or guessing, X-Ray uses static analysis: it resolves types through inheritance, detects declaring classes and tracks argument patterns. The result is an accurate picture of how your project interacts with Nette.
| PHP and PHPT | Latte templates | NEON configuration |
|---|---|---|
| method & function calls | tags & n:attributes | DI service patterns |
| arguments (positional, named) | filters & their arguments | extension registration |
| return value usage | functions & constants | section usage |
| property access | syntax variants | configuration keys |
| class inheritance & traits | ||
| method overrides |
Installation
Install it via Composer as a dev dependency:
composer require --dev nette/xray
It requires PHP 8.2 or higher and runs on PHPStan 2.1. It works with any project using Nette, Latte, Tracy, Dibi or Texy.
Usage
Point it at your source directories:
vendor/bin/xray app/ src/
Within moments you get an interactive HTML report (xray-report.html) you can open in your browser, plus
machine-readable data (xray-report.json):
Nette X-Ray
===========
Scanning PHP files ... 142/142 done
Scanning NEON files ... 4/4 done
Scanning Latte files ... 87/87 done
Reports saved to:
xray-report.json
xray-report.html
Configuration
Create a nette-xray.neon file in your project root to customize the behavior:
# Default analysis paths (used when no CLI arguments are given)
paths:
- app
- src
# Additional directories to exclude (vendor, temp, node_modules, .git are excluded by default)
excludeDirs:
- generated
# Auto-upload without asking
upload: false