My *nix world

PHP file dependencies tree

Sometimes you have a large PHP project and you want to get its big picture (like bird's eye view). You are not interested in how many classes/functions does it have and how are they related to each other. Instead you would like answers to these questions:

  • what are the files this particular file/fileset requires to work and vice-versa
  • if I remove this particular file/fileset what files will not work anymore 'cause they are using it.

I am working nowadays with a quite large PHP project (300+ files) and I have such rhetorical questions quite often lately. So I wrote an small PHP application that provides these answers.

Furthermore, it not only answers those questions but also allows you to see an interactive graphical PHP file dependencies tree for these files (thanks to Springy for their JavaScript forced-directed graph library).

For those impatient check out the project's sandbox.

If you want to use it then get it from its public BitBucket repository.

 

Note
Please note that it is just a couple of days project so don’t judge it too harsh.

 

Because a picture worths more than a thousand words...few screen-shots below from a real project I'm working nowadays:

  1. You start by defining a generic project including a name and its source path.
main

Organize your project/filesets as you wish

  1. You select only those files that matters to you (the fileset).

PHP file dependencies tree

  1. Whenever you are curious about "what files does this file depend on?"

PHP file dependencies tree

  1. ... or vice-versa, "what files do use/need me?"

PHP file dependencies tree

  1. When a picture worths more than a thousand words...

PHP file dependencies tree

  1. ... get a bird's eye view perspective for a specific file

PHP file dependencies tree

Caveat emptor
If your PHP project uses the auto-loading classes functions (eg. spl_autoload_register) then probably you should look for other tools, eg. phpCallGraph or Doxygen (that provides class dependency tree).

Now, if you think that this article was interesting don't forget to rate it. It shows me that you care and thus I will continue write about these things.

The following two tabs change content below.
PHP file dependencies tree

Eugen Mihailescu

Founder/programmer/one-man-show at Cubique Software
Always looking to learn more about *nix world, about the fundamental concepts of math, physics, electronics. I am also passionate about programming, database and systems administration. 16+ yrs experience in software development, designing enterprise systems, IT support and troubleshooting.
PHP file dependencies tree

Latest posts by Eugen Mihailescu (see all)

Tagged on: , ,

Leave a Reply

Your email address will not be published. Required fields are marked *