function export_image($fsm, $filename) { echo "export_image\n"; $outfile = fopen($filename, 'w'); $converter = new FSM_GraphViz($fsm); $graph = $converter->export(); $image = $graph->fetch(); fwrite($outfile, $image); fclose($outfile); }
<?php require_once 'FSM.php'; require_once 'FSM/GraphViz.php'; $payload = array(); $fsm = new FSM('START', $payload); $converter = new FSM_GraphViz($fsm); $graph = $converter->export(); $graph->image('png');