An AST generator based on loophp/phptree.
- PHP >= 7.1
- A PHP Parser:
composer require loophp/phptree-ast-generator
Very basic usage
./path/to/bin/ast generate /path/to/php/file.phpTo generate the dot script for Graphviz
./path/to/bin/ast generate src/Command/Generator.phpUse the -c option to generate a fancy export, user-friendly and less verbose.
./path/to/bin/ast generate -c src/Command/Generator.phpTo generate an image
./path/to/bin/ast generate -c -t image -f png -d graph.png src/Command/Generator.phpThe generator supports 3 PHP parsers:
Use the -p option to change it, default is nikic.
./path/to/bin/ast generate -p microsoft -t image -d graph.svg src/Command/Generator.phpYou will find more documentation within the help of the command:
./path/to/bin/ast generate -hFeel free to contribute to this library by sending Github pull requests. I'm quite reactive :-)
