- install PHP7
- install ast extension
ast.php's output is JSON that represents AST. remove_lineno.php filters out lineno and doccomment from AST.
cat /your/file.php | php ./bin/ast.php | php ./bin/remove_lineno.php
Or you can use Docker.
docker build -t php-ast-json .
cat /your/file.php | docker run -i php-ast-json