Extension exposing PHP 7 abstract syntax tree

php-ast exports the AST internally used by PHP 7.
php-ast is significantly faster than PHP-Parser, because the AST construction is implemented in C.
However, php-ast may only parse code that is syntactically valid on the version of PHP it runs on.

License: BSD-3-Clause

Latest releases

Version Release Download
1.0.14 2021-07-24 ast-1.0.14.tgz
1.0.13 2021-07-08 ast-1.0.13.tgz
1.0.12 2021-05-16 ast-1.0.12.tgz
1.0.11 2021-04-20 ast-1.0.11.tgz
1.0.10 2020-09-12 ast-1.0.10.tgz
Show all releases


Version Message
1.0.14 - Support php 8.1 readonly properties with the flag 'MODIFIER_READONLY'
- Support php 8.1 first-class callable syntax, add the node kind 'AST_CALLABLE_CONVERT'
- Change the current AST version from 80 to the new version 90. AST version 85 is no longer experimental.
1.0.13 - Indicate in metadata that 'AST_CLASS_CONST_GROUP' and 'AST_CLASS_CONST_DECL' can have MODIFIER_FINAL
(and any modifier a class element can have, to reflect what the parser can actually parse)
- Support php 8.1 intersection types, add node kind 'AST_TYPE_INTERSECTION'
1.0.12 - Support parsing 'docComment' on php 8.1 enums
1.0.11 - Add the experimental AST version 85.
- Support php 8.1 enums, add 'type' (for enum type) to AST_CLASS nodes in AST version 85+.
- Support php 8.1 'never' return type.
1.0.10 - Support attributes syntax change (`#[...]`) in php 8.0.0RC1.
- Change the current AST version from 70 to 80. AST version 80 is no longer experimental.
- Add `ReflectionParameter` defaults for `ast\parse_code` and `ast\get_supported_versions` in php 8.
- Add parameter types and return types to reflection for various global functions.
php-ast was already throwing a `TypeError` when invalid parameter types were received.
- Always throw instead of warning when invalid parameters are passed to the ast\Node constructor.
Show complete changelog