File tree Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,24 @@ This extension exposes the abstract syntax tree generated by PHP 7.
2
2
3
3
This extension is experimental and the representation of the syntax tree is not final.
4
4
5
+ Installation
6
+ ------------
7
+
8
+ ** On Windows** : Download a [ prebuilt Windows DLL] ( http://windows.php.net/downloads/pecl/snaps/ast/ )
9
+ and move it into the ` ext/ ` directory of your PHP instalation. Furthermore add
10
+ ` extension=php_ast.dll ` to your ` php.ini ` file.
11
+
12
+ ** On Unix** : Compile and install the extension as follows.
13
+
14
+ ``` sh
15
+ phpize
16
+ ./configure
17
+ make
18
+ sudo make install
19
+ ```
20
+
21
+ Additionally add ` extension=ast.so ` to your ` php.ini ` file.
22
+
5
23
API overview
6
24
------------
7
25
@@ -21,12 +39,12 @@ Usage
21
39
22
40
Code can be parsed using either ` ast\parse_code() ` , which accepts a code string, or
23
41
` ast\parse_file() ` , which accepts a file path. Additionally both functions require a ` $version `
24
- argument to ensure forward-compatibility. The current version is 15 .
42
+ argument to ensure forward-compatibility. The current version is 20 .
25
43
26
44
``` php
27
- $ast = ast\parse_code('<?php ...', $version=15 );
45
+ $ast = ast\parse_code('<?php ...', $version=20 );
28
46
// or
29
- $ast = ast\parse_file('file.php', $version=15 );
47
+ $ast = ast\parse_file('file.php', $version=20 );
30
48
```
31
49
32
50
The abstract syntax tree returned by these functions consists of ` ast\Node ` objects.
You can’t perform that action at this time.
0 commit comments