PHPackages                             prewk/serialized-to-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. prewk/serialized-to-ast

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

prewk/serialized-to-ast
=======================

Parses serialized PHP things to an AST

0.1.0(8y ago)049MITPHPPHP &gt;=7.0

Since Apr 26Pushed 8y ago1 watchersCompare

[ Source](https://github.com/prewk/serialized-to-ast)[ Packagist](https://packagist.org/packages/prewk/serialized-to-ast)[ RSS](/packages/prewk-serialized-to-ast/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (4)Versions (3)Used By (0)

SerializedToAST [![Build Status](https://camo.githubusercontent.com/aa74c5ec46f21598410b2d65633c955d5a38eb38aec65cf93134e3ce2c32702b/68747470733a2f2f7472617669732d63692e6f72672f707265776b2f73657269616c697a65642d746f2d6173742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/prewk/serialized-to-ast) [![Coverage Status](https://camo.githubusercontent.com/419392876d70d7d2d9d798b444e78f989edc3b6a56a412ed301ebdf388b21971/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f707265776b2f73657269616c697a65642d746f2d6173742f62616467652e737667)](https://coveralls.io/github/prewk/serialized-to-ast)
==========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#serializedtoast--)

Parses serialized PHP data, without deserializing, into a simple AST.

Example
-------

[](#example)

```
class Test {
    private $foo = "Private Foo";
    public $bar = 12345;
    protected $baz = ["lorem", "ipsum" => "dolor amet", 67890];
}

$parser = new Prewk\SerializedToAst;
$node = $parser->parse(serialize(new Test));

// Array representation..
$arrayAst = $node->toArray();

// ..or JSON (see below)
$jsonAst = json_encode($node);
```

```
{
    "type": "object",
    "public_properties": {
        "bar": {
            "type": "integer",
            "value": 12345
        }
    },
    "protected_properties": {
        "baz": {
            "type": "array",
            "items": {
                "0": {
                    "type": "string",
                    "value": "lorem"
                },
                "ipsum": {
                    "type": "string",
                    "value": "dolor amet"
                },
                "1": {
                    "type": "integer",
                    "value": 67890
                }
            }
        }
    },
    "private_properties": {
        "foo": {
            "type": "string",
            "value": "Private Foo"
        }
    }
}
```

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

[](#installation)

```
composer require prewk/serialized-to-ast
```

Works for
---------

[](#works-for)

- Booleans
- Integers
- Strings
- Floats
- Null
- Arrays
- Objects

Will cry if fed other stuff.

**Warning**: Experimental and not tested for edge cases.

License
-------

[](#license)

MIT

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~3 days

Total

2

Last Release

2931d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8f3625261e7ace9c6248835418795f4b7f181df06edf191dc26b6ee8c19c3c1d?d=identicon)[prewk](/maintainers/prewk)

---

Top Contributors

[![prewk](https://avatars.githubusercontent.com/u/640102?v=4)](https://github.com/prewk "prewk (6 commits)")

###  Code Quality

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/prewk-serialized-to-ast/health.svg)

```
[![Health](https://phpackages.com/badges/prewk-serialized-to-ast/health.svg)](https://phpackages.com/packages/prewk-serialized-to-ast)
```

###  Alternatives

[mtdowling/jmespath.php

Declaratively specify how to extract elements from a JSON document

2.0k472.8M135](/packages/mtdowling-jmespathphp)[opis/closure

A library that can be used to serialize closures (anonymous functions) and arbitrary data.

2.6k230.0M283](/packages/opis-closure)[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M226](/packages/masterminds-html5)[sabberworm/php-css-parser

Parser for CSS Files written in PHP

1.8k191.2M63](/packages/sabberworm-php-css-parser)[michelf/php-markdown

PHP Markdown

3.5k52.4M344](/packages/michelf-php-markdown)[jms/metadata

Class/method/property metadata management in PHP

1.8k152.8M88](/packages/jms-metadata)

PHPackages © 2026

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