Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dependencies graph for large PHP application

I've recently inherited a large PHP application with NO objects/modules/namespaces...only a lot of files containing functions.

Of course, there is a LOT of dependencies (and all files and almost always included).

I'm looking for a tool that could analyse the files and generate a dependencies graph. It would then be easier to detect independent files/set of files and re-factor the whole thing.

So far the best solution I've found would be to write a CodeSniffer sniff to detect all functions calls and then use that to generate the graph.

It seems something useful for other, so I'm sure tools already exists for it.

What would you recommend ?

like image 981
Loïc Février Avatar asked Sep 10 '13 10:09

Loïc Février


1 Answers

I think that the best solution is use a doc generat + grapviz, PHPDocumentor looks to have a Grapviz extension at https://github.com/phpDocumentor/GraphViz

This is a example made with PHPDocumentor: http://demo.phpdoc.org/Clean/graphs/classes.svg

Too you can use a hierarchical profiler like xhprof (https://github.com/facebook/xhprof), this can draw a tree of all call to functions from a execution.

A example form xhprof draw done by Graphviz A example form xhprof draw done by Graphviz

like image 74
mcuadros Avatar answered Oct 18 '22 17:10

mcuadros