Interactive terminal scanner for finding legacy PHP patterns and assigning migration priority.
PHP Legacy Scanner TUI helps you audit older PHP codebases by scanning PHP files for outdated, deprecated, or risky constructs.
It presents findings in a terminal UI, lets you review them with context, assign decisions, and export results for further analysis or CI.
This is especially useful for:
- PHP 5.x to PHP 8.x migration audits
- legacy monolith cleanup
- technical debt reviews
- upgrade planning and triage
- scans PHP files for legacy constructs
- interactive TUI built with
curses - migration priority levels:
critical,high,medium,low - color-coded
FindingsandHelp Detailspanel with code context- filters by status, type, priority, and path
- baseline support for accepted findings
- JSON and CSV report export
- CI mode with configurable minimum priority threshold
- support for excluding folders and file patterns
Examples of what the scanner can detect:
mysql_*API usageereg/eregisplit/splitieach()create_function()preg_replace(... /e)eval()- short open tags
<? - PHP 4 style constructors
var $property__autoload()get_magic_quotes_gpc()register_globalschecks- dynamic
include/require - raw
$_REQUEST - compact ternary
?:
The tool assigns a migration priority to each finding:
| Priority | Meaning |
|---|---|
critical |
High-risk constructs that should be migrated first |
high |
Strong migration blockers or risky legacy design |
medium |
Deprecated APIs and outdated constructs |
low |
Minor legacy leftovers and cleanup candidates |
- Python 3.9+
- terminal with
cursessupport
Run an interactive scan:
python scan_legacy_php.py /path/to/projectRun in CI mode:
python scan_legacy_php.py /path/to/project --ciFail CI only for high and above:
python scan_legacy_php.py /path/to/project --ci --ci-min-priority highExclude extra directories:
python scan_legacy_php.py /path/to/project --exclude cache --exclude tmpExclude extra files or glob patterns:
python scan_legacy_php.py /path/to/project --exclude-file "*.min.php"After scanning, the tool writes:
legacy-report.json— full report with contextlegacy-report.csv— flat CSV report
You can override output paths:
python scan_legacy_php.py /path/to/project --report-json out/legacy-report.json --report-csv out/legacy-report.csvAccepted findings can be saved to a baseline file.
Default baseline file:
.legacy-php-baseline.jsonCustom baseline file:
python scan_legacy_php.py /path/to/project --baseline custom-baseline.jsonTypical flow:
- scan the project
- review findings in TUI
- mark known acceptable findings
- save baseline with
w - use
--cito detect newly introduced legacy patterns
↑ / ↓ / PgUp / PgDn— move through findings← / →— horizontal scrollEnter— open details modalh— open help / aboutq / Esc— close modal or quit
a— mark as acceptedr— mark as rejecteds— mark as skippedu— reset to pending
f— cycle status filtert— cycle legacy type filterp— cycle priority filter/— filter by file pathc— clear filters
w— save baseline
Common directories excluded by default:
.gitnode_modulesvendordistbuild
Default excluded file patterns:
*.min.php
0— no new findings at or above the configured priority2— new findings detected at or above the configured priority1— invalid path or startup error
- detection is regex-based and may produce false positives
- not every legacy construct is automatically unsafe
- some findings still require manual migration review
MIT






