---
name: "php-parse"
section: "1"
platform: "linux"
package: "php-parser"
version: "5.4.0-3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/php-parse"
---

# php-parse(1)

command line interface for PHP Parser

## 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):

- **-d**, **--dump**

  Dump nodes using NodeDumper

- **-p**, **--pretty-print**

  Pretty print file using PrettyPrinter\\Standard

- **-j**, **--json-dump**

  Print json\_encode() result

- **--var-dump**

  var\_dump() nodes (for exact structure)

- **-N**, **--resolve-names**

  Resolve names using NodeVisitor\\NameResolver

- **-c**, **--with-column-info**

  Show column-numbers for errors (if available)

- **-P**, **--with-positions**

  Show positions in node dumps

- **-r**, **--with-recovery**

  Use parsing with error recovery

- **--version**=*VERSION*

  Target specific PHP version (default: newest)

- **-h**, **--help**

  Display this page

### Example:

-

  php-parse **-d** **-p** **-N** **-d** file.php

-

  Dumps nodes, pretty prints them, then resolves names and dumps them again.
