ast

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.16 2021-11-27 ast-1.0.16.tgz
1.0.15 2021-11-27 ast-1.0.15.tgz
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
Show all releases

Changelog

Version Message
1.0.16 - Optimize instantiating properties of ast\Node and ast\Metadata.
- Document that ast\Node implements `#[AllowDynamicProperties]` in php 8.2
1.0.15 - Allow ast\Node to have dynamic properties without emitting a notice in PHP 8.2.
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
Show complete changelog