4 [![Build Status](https://travis-ci.org/nikic/PHP-Parser.svg?branch=master)](https://travis-ci.org/nikic/PHP-Parser) [![Coverage Status](https://coveralls.io/repos/github/nikic/PHP-Parser/badge.svg?branch=master)](https://coveralls.io/github/nikic/PHP-Parser?branch=master)
6 This is a PHP 5.2 to PHP 7.1 parser written in PHP. Its purpose is to simplify static code analysis and
9 [**Documentation for version 3.x**][doc_master] (stable; for running on PHP >= 5.5; for parsing PHP 5.2 to PHP 7.1).
11 [Documentation for version 2.x][doc_2_x] (stable; for running on PHP >= 5.4; for parsing PHP 5.2 to PHP 7.0).
13 [Documentation for version 1.x][doc_1_x] (unsupported; for running on PHP >= 5.3; for parsing PHP 5.2 to PHP 5.6).
18 The parser turns PHP source code into an abstract syntax tree. For example, if you pass the following code into the
24 hello\world('foo', 'bar' . 'baz');
27 You'll get a syntax tree looking roughly like this:
71 You can then work with this syntax tree, for example to statically analyze the code (e.g. to find
72 programming errors or security issues).
74 Additionally, you can convert a syntax tree back to PHP code. This allows you to do code preprocessing
75 (like automatedly porting code to older PHP versions).
80 The preferred installation method is [composer](https://getcomposer.org):
82 php composer.phar require nikic/php-parser
87 1. [Introduction](doc/0_Introduction.markdown)
88 2. [Usage of basic components](doc/2_Usage_of_basic_components.markdown)
89 3. [Other node tree representations](doc/3_Other_node_tree_representations.markdown)
90 4. [Code generation](doc/4_Code_generation.markdown)
92 Component documentation:
94 1. [Error handling](doc/component/Error_handling.markdown)
95 2. [Lexer](doc/component/Lexer.markdown)
97 [doc_1_x]: https://github.com/nikic/PHP-Parser/tree/1.x/doc
98 [doc_2_x]: https://github.com/nikic/PHP-Parser/tree/2.x/doc
99 [doc_master]: https://github.com/nikic/PHP-Parser/tree/master/doc