Ultra-fast PHP function signature extractor written in Go.
go mod tidy
go test ./...
go build -o bin/phpfuncparser ./cmd/phpfuncparserScan a directory recursively and write report to a file:
./bin/phpfuncparser -path ./src -recursive -report functions.txtScan a single file and print to stdout:
./bin/phpfuncparser -path ./index.phpCompare two existing reports and output what was added/changed:
./bin/phpfuncparser -diff-old functions_prev.txt -diff-new functions_new.txt -report functions_delta.txtEnables diff mode: compares two reports in the text format produced by this tool.
The output contains only the function signatures that exist in the new report but are missing from the old report.
This catches:
- brand new functions
- changed signatures (params modified/added/removed)
Rules:
-diff-oldand-diff-newmust be provided together-pathmust not be used together with diff mode
Example:
./bin/phpfuncparser -diff-old functions_prev.txt -diff-new functions_new.txt -report functions_delta.txtPath to a PHP file or a directory to scan.
Examples:
./bin/phpfuncparser -path ./index.php
./bin/phpfuncparser -path ./srcIf -path points to a directory, enables recursive traversal of subdirectories.
Default: false
Example:
./bin/phpfuncparser -path ./src -recursiveOutput report destination.
- If set: writes to the specified file (created or truncated).
- If not set: prints to stdout.
Example:
./bin/phpfuncparser -path ./src -recursive -report functions.txtNumber of concurrent workers used for scanning files.
0means auto (runtime-based default).- For SSD/NVMe, higher values may improve throughput; for HDD/network FS, too high may degrade performance.
Default: 0
Examples:
./bin/phpfuncparser -path ./src -recursive -workers 0
./bin/phpfuncparser -path ./src -recursive -workers 16Log verbosity level.
Supported values:
debuginfowarnerror
Default: info
Examples:
./bin/phpfuncparser -path ./src -recursive -log debug
./bin/phpfuncparser -path ./src -recursive -log error/path/to/file1.php
function foo($a, $b = 1)
function bar()
/path/to/file2.php
function baz(int $x)
- Only named
function <name>(...)declarations are reported (anonymous functions are skipped). - The parser is a purpose-built single-pass scanner that ignores strings and comments.
- Logging goes to stderr; the report goes to
-reportor stdout.