Any decent PHP parser written in PHP? [closed]

After no complete and stable parser was found here I decided to write one myself. Here is the result:

PHP-Parser: A PHP parser written in PHP

The project supports parsing code written for any PHP version between PHP 5.2 and PHP 8.1.

Apart from the parser itself the library provides some related components:

  • Compilation of the AST back to PHP (“pretty printing”)
  • Infrastructure for traversing and changing the AST
  • Serialization to and from XML (as well as dumping in a human readable form)
  • Converting an AST into JSON and back.
  • Resolution of namespaced names (aliases etc.)

For an usage overview see the “Usage of basic components” section of the documentation.

Leave a Comment