PHPackages                             mck89/peast - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. mck89/peast

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

mck89/peast
===========

Peast is PHP library that generates AST for JavaScript code

v1.17.6(1mo ago)19037.7M↓25.3%24[1 issues](https://github.com/mck89/peast/issues)20BSD-3-ClausePHPPHP &gt;=5.4.0CI passing

Since Sep 11Pushed 1mo ago9 watchersCompare

[ Source](https://github.com/mck89/peast)[ Packagist](https://packagist.org/packages/mck89/peast)[ RSS](/packages/mck89-peast/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (10)Dependencies (3)Versions (70)Used By (20)

Peast
=====

[](#peast)

[![Latest Stable Version](https://camo.githubusercontent.com/01dc14dda7553d254bb5740be57bc53fbc55fad957d4d1bffb3fc620b27c7cf4/68747470733a2f2f706f7365722e707567782e6f72672f6d636b38392f70656173742f762f737461626c65)](https://packagist.org/packages/mck89/peast)[![Total Downloads](https://camo.githubusercontent.com/ebcfc86965e1aa084159376b3d9cdd4cabdbe30b27837aaff08d0e47082a5ad4/68747470733a2f2f706f7365722e707567782e6f72672f6d636b38392f70656173742f646f776e6c6f616473)](https://packagist.org/packages/mck89/peast)[![License](https://camo.githubusercontent.com/de9e95bd9338cfda81c20aa0b8722029a176fd5d31f15fca60a5e0def533150c/68747470733a2f2f706f7365722e707567782e6f72672f6d636b38392f70656173742f6c6963656e7365)](https://packagist.org/packages/mck89/peast)[![Build Status](https://github.com/mck89/peast/actions/workflows/test.yml/badge.svg)](https://github.com/mck89/peast/actions/workflows/test.yml)

**Peast** *(PHP ECMAScript Abstract Syntax Tree)* is a PHP 5.4+ library that parses JavaScript code, according to [ECMAScript specification](http://www.ecma-international.org/publications/standards/Ecma-262.htm), and generates an abstract syntax tree following the [ESTree standard](https://github.com/estree/estree).

Installation
------------

[](#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!
```

Known issues
------------

[](#known-issues)

When Xdebug is enabled and Peast is used to scan code that contains deeply nested functions, this fatal error can appear:

```
PHP Fatal error:  Maximum function nesting level of '512' reached, aborting!

```

or

```
PHP Warning:  Uncaught Error: Xdebug has detected a possible infinite loop, and aborted your script with a stack depth of '256' frames

```

To prevent this you can set `xdebug.max_nesting_level` to a higher value, such as 512.

Documentation
-------------

[](#documentation)

Read the documentation for more examples and explanations:

1. [AST generation and tokenization](doc/ast-and-tokenization.md)
2. [Tree Traversing](doc/tree-traversing.md)
3. [Querying By Selector](doc/querying-by-selector.md)
4. [Rendering](doc/rendering.md)

[Changelog](doc/changelog.md)

###  Health Score

70

—

ExcellentBetter than 100% of packages

Maintenance90

Actively maintained with recent releases

Popularity68

Solid adoption and visibility

Community37

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 97.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~53 days

Recently: every ~74 days

Total

67

Last Release

46d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d80aaab62ed0d1a3d39fe7e3d8fca53855514e6503d704182cc4d7f0346fd9ba?d=identicon)[mck89](/maintainers/mck89)

---

Top Contributors

[![mck89](https://avatars.githubusercontent.com/u/466041?v=4)](https://github.com/mck89 "mck89 (678 commits)")[![jrfnl](https://avatars.githubusercontent.com/u/663378?v=4)](https://github.com/jrfnl "jrfnl (5 commits)")[![malte-christian](https://avatars.githubusercontent.com/u/3236302?v=4)](https://github.com/malte-christian "malte-christian (2 commits)")[![reedy](https://avatars.githubusercontent.com/u/67615?v=4)](https://github.com/reedy "reedy (2 commits)")[![sdnunca](https://avatars.githubusercontent.com/u/23708351?v=4)](https://github.com/sdnunca "sdnunca (1 commits)")[![seka19](https://avatars.githubusercontent.com/u/2714877?v=4)](https://github.com/seka19 "seka19 (1 commits)")[![siddharthvp](https://avatars.githubusercontent.com/u/31818903?v=4)](https://github.com/siddharthvp "siddharthvp (1 commits)")[![andypost](https://avatars.githubusercontent.com/u/73713?v=4)](https://github.com/andypost "andypost (1 commits)")[![soullivaneuh](https://avatars.githubusercontent.com/u/1698357?v=4)](https://github.com/soullivaneuh "soullivaneuh (1 commits)")[![exussum12](https://avatars.githubusercontent.com/u/1102850?v=4)](https://github.com/exussum12 "exussum12 (1 commits)")[![krizalys](https://avatars.githubusercontent.com/u/1499352?v=4)](https://github.com/krizalys "krizalys (1 commits)")[![schlessera](https://avatars.githubusercontent.com/u/83631?v=4)](https://github.com/schlessera "schlessera (1 commits)")

---

Tags

ast-generationecmascriptjavasciptjavascriptparserparsingphpsyntax-treetokenizertraversevalidator

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mck89-peast/health.svg)

```
[![Health](https://phpackages.com/badges/mck89-peast/health.svg)](https://phpackages.com/packages/mck89-peast)
```

###  Alternatives

[karriere/json-decoder

JsonDecoder implementation that allows you to convert your JSON data into PHP class objects

141439.4k12](/packages/karriere-json-decoder)[sauladam/shipment-tracker

Parses tracking information for several carriers, like UPS, USPS, DHL and GLS by simply scraping the data. No need for any kind of API access.

9642.0k](/packages/sauladam-shipment-tracker)[jstewmc/rtf

Read and write Rich Text Format (RTF) documents with PHP

45143.1k6](/packages/jstewmc-rtf)[json-mapper/laravel-package

The JsonMapper package for Laravel

25188.9k3](/packages/json-mapper-laravel-package)[jamesmoss/toml

A parser for TOML implemented in PHP.

3231.7k15](/packages/jamesmoss-toml)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
