定制 prewk/serialized-to-ast 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-04-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固