A tool to analyze keyword usage across PHP packages to assess the impact of reserving new keywords in PHP.
Built for PHP internals developers and RFC authors to make data-driven decisions about language evolution.
# Download and analyze top 10,000 packages
cargo run --release -- -k let -k using -k scope --max 10000
# Analyze existing downloads
cargo run --release -- -k with --skip-downloadkeyword-impact-analyzer [OPTIONS] --keyword <KEYWORD>
Options:
-k, --keyword <KEYWORD> Keywords to analyze (repeatable)
--min <MIN> Minimum package index [default: 0]
--max <MAX> Maximum package index [default: 500]
-d, --directory <DIR> Download directory [default: downloads]
--skip-download Skip download phase
-h, --help Print help- Download: Fetches top N packages from Packagist
- Extract: Extracts packages
- Analyze: Parses PHP files and tracks keyword usage:
- Soft tracking: Function names, function calls, and closure creations
- Hard tracking: All identifiers (includes soft + symbol names, metohds, etc.)
Results are displayed as a table:
+---------+------+-------+-------------+-------------+-------------------------------------------------------+
| Keyword | Soft | Hard | Soft Impact | Hard Impact | Well-Known Vendors |
+---------+------+-------+-------------+-------------+-------------------------------------------------------+
| with | 174 | 36393 | High | Critical | doctrine, illuminate, laravel, phpunit, symfony, twig |
+---------+------+-------+-------------+-------------+-------------------------------------------------------+
| scope | 0 | 3428 | None | Critical | laravel, symfony |
+---------+------+-------+-------------+-------------+-------------------------------------------------------+
| block | 1 | 2476 | Low | Critical | doctrine, laravel |
+---------+------+-------+-------------+-------------+-------------------------------------------------------+
| let | 4 | 1031 | Low | Critical | - |
+---------+------+-------+-------------+-------------+-------------------------------------------------------+
| using | 0 | 485 | None | High | laravel, phpunit |
+---------+------+-------+-------------+-------------+-------------------------------------------------------+
| temp | 0 | 197 | None | High | - |
+---------+------+-------+-------------+-------------+-------------------------------------------------------+
| scoped | 2 | 54 | Low | Medium | - |
+---------+------+-------+-------------+-------------+-------------------------------------------------------+
Impact Levels:
- None: 0 occurrences
- Low: 1-25 occurrences
- Medium: 26-100 occurrences
- High: 101-500 occurrences
- Critical: 501+
--max for comprehensive results.
Analysis results for various RFCs:
- Opt-in Block Scoping (
useconstruct) - 626,044 files analyzed- ✅ Safe:
scope,block,let,using,scoped ⚠️ Conflicts:with(174 occurrences)
- ✅ Safe:
To add analysis for a new RFC:
- Run the tool with your candidate keywords
- Create a new file in
rfcs/your_rfc_name.md - Document the results and add a link in this README
This project is distributed under the MIT License. See LICENSE for more information.