Dependencies graph for large PHP application Dependencies graph for large PHP application php php

Dependencies graph for large PHP application


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 GraphvizA example form xhprof draw done by Graphviz


I could recommend a lightweight project I wrote few days ago. Basically I had a 300+ files PHP project and I wanted to detect what files do these files require/include and vice-versa. Moreover, I wanted to check for each individual file what files does this file requires/includes (directly or indirectly, ie. via file inheritance) and vice-versa: what are the files that include this particular file. For any combination of these I wanted an interactive dependency graph (base on file inclusion and not on class/function calls/usage).

Check out the project's sandbox and its source code.

Note that the whole thing was written in only 2 days so don't judge it too harsh. What's important is that it's doing its job!