silverfoxy/php-cfg
最新稳定版本:v0.5.0
Composer 安装命令:
composer require silverfoxy/php-cfg
包简介
A fork of Control Flow Graph implementation for PHP with meta stats information
README 文档
README
PHP-CFG
Pure PHP implementation of a control flow graph (CFG) with instructions in static single assignment (SSA) form.
The used SSA construction algorithm is based on "Simple and Efficient Construction of Static Single Assignment Form" by Braun et al. This algorithm constructs SSA form directly from the abstract syntax tree, without going through a non-SSA IR first. If you're looking for dominance frontiers, you won't find them here...
The constructed SSA form is minimal and pure (or is supposed to be).
Usage
To bootstrap the parser, you need to give it a PhpParser instance:
$parser = new PHPCfg\Parser( (new PhpParser\ParserFactory)->create(PhpParser\ParserFactory::PREFER_PHP7) );
Then, just call parse on a block of code, giving it a filename:
$script = $parser->parse(file_get_contents(__FILE__), __FILE__);
To dump the graph, simply use the built-in dumper:
$dumper = new PHPCfg\Printer\Text(); echo $dumper->printScript($script);
统计信息
- 总下载量: 10
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD
- 更新时间: 2022-07-06