Generates Abstrax Syntax Tree (AST) of a PHP script in DOT (Graphviz) or Image (PNG, JPG, SVG) formats.
An AST generator based on loophp/phptree.
composer require loophp/phptree-ast-generator
Very basic usage
```shell script
./path/to/bin/ast generate /path/to/php/file.php
To generate the `dot` script for Graphviz
```shell script
./path/to/bin/ast generate src/Command/Generator.php
Use the -c
option to generate a fancy export, user-friendly and less verbose.
```shell script
./path/to/bin/ast generate -c src/Command/Generator.php
To generate an image
```shell script
./path/to/bin/ast generate -c -t image -f png -d graph.png src/Command/Generator.php
The generator supports 3 PHP parsers:
Use the -p
option to change it, default is nikic
.
```shell script
./path/to/bin/ast generate -p microsoft -t image -d graph.svg src/Command/Generator.php
You will find more documentation within the help of the command:
```shell script
./path/to/bin/ast generate -h
Feel free to contribute to this library by sending Github pull requests. I’m quite reactive :-)