https://github.com/nette/xray
🔬 Nette X-Ray - see exactly how your project uses the Nette ecosystem
https://github.com/nette/xray
Last synced: about 2 months ago
JSON representation
🔬 Nette X-Ray - see exactly how your project uses the Nette ecosystem
- Host: GitHub
- URL: https://github.com/nette/xray
- Owner: nette
- License: other
- Created: 2026-03-05T11:44:07.000Z (about 2 months ago)
- Default Branch: master
- Last Pushed: 2026-03-06T21:32:13.000Z (about 2 months ago)
- Last Synced: 2026-03-10T22:53:26.226Z (about 2 months ago)
- Language: PHP
- Homepage:
- Size: 43.9 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
README
# Nette Xray

[](https://packagist.org/packages/nette/xray)
[](https://github.com/nette/xray/actions)
[](https://github.com/nette/xray/releases)
[](https://github.com/nette/xray/blob/master/license.md)
### See exactly how your project uses the Nette ecosystem
Ever wondered which Nette methods you call the most? Which Latte filters you actually use? Whether anyone still touches that old configuration key?
Nette Xray scans your codebase and gives you a detailed, visual breakdown of your Nette API usage - every method call, every template filter, every config pattern.
✅ deep PHP analysis powered by PHPStan's type system
✅ Latte template analysis - tags, filters, n:attributes
✅ NEON configuration analysis - services, extensions, settings
✅ beautiful standalone HTML report you can explore
✅ completely anonymized - no code, no names, just numbers
How It Works
============
Nette Xray uses static analysis to understand your code precisely - not regex, not guessing. It resolves types through inheritance, detects declaring classes, and tracks argument patterns. The result is an accurate picture of how your project interacts with the Nette ecosystem.
**What gets analyzed:**
| PHP / PHPT | Latte templates | NEON config |
|---|---|---|
| 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 | dynamic elements | database keys |
| method overrides | self-closing tags | |
| constants & instantiation | | |
| callable references | | |
Installation
============
```shell
composer require --dev nette/xray
```
Requires PHP 8.2 or higher. Runs on PHPStan 2.1. Works with any project using Nette, Latte, Tracy, Dibi, or Texy.
Usage
=====
Point it at your source directories:
```shell
vendor/bin/xray app/ src/
```
That's it. Within moments you get:
1. **HTML report** (`xray-report.html`) - an interactive visual breakdown you can open in your browser
2. **JSON data** (`xray-report.json`) - structured data for further processing
```
Nette Xray
==========
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
```
The HTML Report
---------------
The HTML report is a standalone file - no server needed, just open it in your browser. It gives you a complete picture:
- Which Nette APIs your project depends on most
- How you pass arguments - positionally or by name
- Which methods you override from Nette base classes
- Which Latte filters and tags dominate your templates
- How your DI configuration is structured
It's your project's X-ray.
Configuration
-------------
Create a `nette-xray.neon` file in your project root to customize behavior:
```neon
# Default analysis paths (used when no CLI arguments given)
paths:
- app
- src
# Additional directories to exclude (vendor, temp, node_modules, .git excluded by default)
excludeDirs:
- generated
# Auto-upload without asking (default: false)
upload: true
```
Help Shape the Future of Nette
===============================
When you run Nette Xray, you can optionally send the anonymized report to help guide Nette's development:
```
Share anonymized data with Nette? [y/N] y
Data sent. Thank you!
```
**What gets sent:** only aggregated numbers - how many times each API is called, which patterns are used. No file paths, no variable names, no business logic. Just statistics.
**Why it matters:** real usage data helps prioritize what to improve, what to keep, and what can safely evolve. It's far more reliable than surveys.
Privacy
=======
Nette Xray is designed with privacy as a core principle:
- **No code is collected** - only counts and patterns
- **No file paths** - you can't tell what the project does
- **No string values** - argument values are never captured
- **Completely optional** - data is only sent if you explicitly confirm
- **Open source** - you can read exactly what gets collected
The JSON report is saved locally first. You can inspect it before deciding to share.
[Support Me](https://github.com/sponsors/dg)
=============================================
Do you like Nette Xray? Are you looking forward to the new features?
[](https://github.com/sponsors/dg)
Thank you!