Skip to content

NetPainter/php-cfg

 
 

Repository files navigation

Build Status

PHP-CFG

A Control-Flow-Graph implementation in Pure PHP.

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:

$block = $parser->parse(file_get_contents(__FILE__), __FILE__);

To dump the graph, simply use the built-in dumper:

$dumper = new PHPCfg\Printer\Text();
echo $dumper->printCFG(array($block));

About

A Control Flow Graph implementation in PHP

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%