tags:

views:

144

answers:

5
+7  Q: 

PHP Callstack tool

Am working on a very large PHP application written by someone else.

Does anyone know of any tool (free or commercial) that would allow me to diagram which PHP file includes / calls / needs which other PHP file ?

I tried nWire for PHP and it doesn't accurately capture my include () calls.

+2  A: 

Not sure about such tool but to know what files are included, you can use get_included_files and you can get defined variables, constants and functions like this

// get vars
$vars = get_defined_vars();
// get constants
$consts = get_defined_constants();
// get functions
$funcs = get_defined_functions();

get_defined_vars
get_defined_constants
get_defined_functions

Sarfraz
+3  A: 

If i understood you right and you want a tool that shows which include calls you made. Or did you mean a tool which shows which includes some files require?

Have a look at Xdebug i think it should be capable of doing the first thing:

Xdebug stack trace

TheCandyMan666
A: 

phpDocumentor will at least list out all your classes and document them in HTML format with links in each class to the required classes. You can also extend the behavior of phpDoc if you want to do dependency graphing in a particular way. phpDoc is loosely based on javadoc.

Zak
A: 

Try Inclued, a PECL package that extends PHP and reports file inclusions and other information. The manual introduction says:

Traces through and dumps the hierarchy of file inclusions and class inheritance at runtime. The files may have been included using include(), include_once(), require(), or require_once(). Class inheritance dependencies are also reported.

Also check out PHP_Depend, a code metrics tool for PHP. This does not exactly show file dependencies, but it reports code complexity metrics that may be of help as you're maintaining and refactoring an inherited PHP project.

Bill Karwin
A: 

If you don't mind UML, Enterprise Architect makes some pretty good autogenerated class diagrams. I use it for most of my projects :) It's a bit costly, but it's worth it

http://www.sparxsystems.com/products/ea/index.html

Thomas Winsnes