PHPackages                             open-code-modeling/php-code-ast - 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. open-code-modeling/php-code-ast

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

open-code-modeling/php-code-ast
===============================

Open Code Modeling PHP Code AST

0.12.3(4y ago)71.2k↓82.1%1[3 issues](https://github.com/open-code-modeling/php-code-ast/issues)[4 PRs](https://github.com/open-code-modeling/php-code-ast/pulls)3MITPHPPHP ^7.4 || ^8.0

Since Aug 7Pushed 1y ago3 watchersCompare

[ Source](https://github.com/open-code-modeling/php-code-ast)[ Packagist](https://packagist.org/packages/open-code-modeling/php-code-ast)[ RSS](/packages/open-code-modeling-php-code-ast/feed)WikiDiscussions 0.13.x Synced 1w ago

READMEChangelog (10)Dependencies (9)Versions (46)Used By (3)

PHP Code AST
============

[](#php-code-ast)

PHP code generation based on AST.

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

[](#installation)

```
$ composer require open-code-modeling/php-code-ast
```

Usage
-----

[](#usage)

> See unit tests in `tests` folder for comprehensive examples.

Let's start with a straightforward example of generating a class with the `ClassBuilder`:

```
