2017 © Pedro Peláez
 

library serialized-to-ast

Parses serialized PHP things to an AST

image

prewk/serialized-to-ast

Parses serialized PHP things to an AST

  • Thursday, May 3, 2018
  • by prewk
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

SerializedToAST Build Status Coverage Status

Parses serialized PHP data, without deserializing, into a simple AST., (*1)

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

composer require prewk/serialized-to-ast

Works for

  • Booleans
  • Integers
  • Strings
  • Floats
  • Null
  • Arrays
  • Objects

Will cry if fed other stuff., (*2)

Warning: Experimental and not tested for edge cases., (*3)

License

MIT, (*4)

The Versions

03/05 2018

dev-master

9999999-dev

Parses serialized PHP things to an AST

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

30/04 2018

0.1.0

0.1.0.0

Parses serialized PHP things to an AST

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

26/04 2018

0.0.1

0.0.1.0

Parses serialized PHP things to an AST

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires