PHP Classes
elePHPant
Icontem

File: README

Recommend this page to a friend!
  Classes of Colin McKinnon  >  Code Graph  >  README  >  Download  
File: README
Role: Documentation
Content type: text/plain
Description: instructions
Class: Code Graph
Generate call graphs of PHP code with GraphViz
Author: By
Last change: Revised documentation
Date: 5 years ago
Size: 1,953 bytes
 

Contents

Class file image Download
Codegraph requires the Graphviz package (which does the *really* clever
stuff). Codegraph ppackages are available from various places, or you can download the source at:

http://www.graphviz.org/

This is the second release version which has a much cleaner API. 

To see what it does checkout the key.jpeg and self.jpeg files (the latter is
the result of running the code on itself). The example scripts expects a writable
directory called 'graphs' in the same dir.

The dotwriter.inc.php defines 2 classes and some supporting functions. It should
come with this readme.txt file and 3 example scripts.

* example1.php
  provides a user to upload a PHP src file
  and returns the resulting jpeg image

* example2.php
  This was front end which shiped with the first verion - and 
  allows you to try out the different options for the graph
  generator

* example3.php
  This script defines a callback handler which adds URLs to the
  nodes rendered in the image - maaking them clickable.
  It is configured to geerate links to PHPXREF documentation.

It has been written for 
Unix/Linux systems but would not require l ot of changes to support MSWindows: I believe 
the only change necessary is to specify the location of the graphViz dot interpreter. 
This is currently hard-coded as /usr/bin/dot. However the value can be overridden at
run time between instantiating the dotrunner class and generating the output file,
e.g.

    $c = new dotrunner();
    $c->graphVizBin='/windows/cygwin/usr/bin/dot.exe';
    $c->outputFileName=tempnam('graphs/','graph');
    $c->genGraph(....


To see what it does checkout the key.jpeg and self.jpeg files (the latter is
the result of running the code on itself). The script expects a writable
directory called 'graphs' in the same dir. 

Note the 'cleanUp()' method defined in the class deletes the graphViz input file but not
the output file(s). You should plan to make some provision for these in your own code.