automit2021 / peast
Peast is PHP library that generates AST for JavaScript code
v2.0.0
2022-08-23 19:35 UTC
Requires
- php: >=8.1.0
- ext-mbstring: *
Requires (Dev)
- phpunit/phpunit: ^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0
- v2.0.0
- v1.13.10
- dev-master / 1.13.9.x-dev
- v1.13.9
- v1.13.8
- v1.13.7
- v1.13.6
- v1.13.5
- v1.13.4
- v1.13.3
- v1.13.2
- v1.13.0
- 1.12.x-dev
- v1.12.0
- 1.11.x-dev
- v1.11.0
- 1.10.x-dev
- v1.10.4
- v1.10.3
- v1.10.2
- v1.10.1
- v1.10
- 1.9.x-dev
- v1.9.4
- v1.9.3
- v1.9.2
- v1.9.1
- v1.9
- 1.8.x-dev
- v1.8.1
- v1.8
- 1.7.x-dev
- v1.7
- 1.6.x-dev
- v1.6
- 1.5.x-dev
- v1.5
- 1.4.x-dev
- v1.4
- 1.3.x-dev
- v1.3
- 1.2.x-dev
- v1.2
- 1.1.x-dev
- v1.1
- 1.0.x-dev
- v1.0
- dev-php-8.1
- dev-performance
This package is auto-updated.
Last update: 2025-02-24 01:11:52 UTC
README
Peast (PHP ECMAScript Abstract Syntax Tree) is a PHP 5.4+ library that parses JavaScript code, according to ECMAScript specification, and generates an abstract syntax tree following the ESTree standard.
Installation
Include the following requirement to your composer.json:
{
"require": {
"mck89/peast": "dev-master"
}
}
Run composer install
to install the package.
Then in your script include the autoloader and you can start using Peast:
require_once "vendor/autoload.php"; $source = "var a = 1"; //Your JavaScript code $ast = Peast\Peast::latest($source, $options)->parse(); //Parse it!
Documentation
Read the documentation for more examples and explanations: