There's no magic tool that will do this for you, there's only functionality that will help you implement your own solution.
The function you want is
get_included_files();
This will return an array of any file that's been included so far. Put this at the end of your bootstrap file (or at the end of all your individual files) and you can get a list of every file that's been included or required. This will NOT report on files opened with file_get_contents
, fopen
, etc. That's why its a good idea to have some kind of wrapper functions/classes that will call these functions for you (allowing you to hook into the actions if need be)
The approach I'd take it to add in code that logs the included files somewhere and then let your app run for a day or two (or exercise all its functionality yourself) This should give you a complete list of files that your project is actually using, allow you to clean up files that don't appear on the list. This logging could be as simple as
file_put_contents('/tmp/files.txt',print_r(get_included_files(), true),FILE_APPEND);