prewk/serialized-to-ast
Composer 安装命令:
composer require prewk/serialized-to-ast
包简介
Parses serialized PHP things to an AST
README 文档
README
Parses serialized PHP data, without deserializing, into a simple AST.
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.
Warning: Experimental and not tested for edge cases.
License
MIT
统计信息
- 总下载量: 49
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-04-26