Scroll to navigation

PHP-PARSE(1) User Commands PHP-PARSE(1)

NAME

php-parse - command line interface for PHP Parser

SYNOPSIS

php-parse [operations] file1.php [file2.php ...]
php-parse [operations] "<?php code"

DESCRIPTION

Turn PHP source code into an abstract syntax tree.

Operations is a list of the following options (--dump by default):

Dump nodes using NodeDumper
Pretty print file using PrettyPrinter\Standard
Print json_encode() result
var_dump() nodes (for exact structure)
Resolve names using NodeVisitor\NameResolver
Show column-numbers for errors (if available)
Show positions in node dumps
Use parsing with error recovery
Target specific PHP version (default: newest)
Display this page

Example:

php-parse -d -p -N -d file.php
Dumps nodes, pretty prints them, then resolves names and dumps them again.
December 2023 php-parse 5.0.0~rc1