1

I am working on complex php site that uses lots of rewrite rules, includes, requires, classes etc.

What would be the best strategy to print out all included files involved in each php page ?

I need to make some modifications on a page, and I have no idea what php scripts are involved since there are tons of php pages, functions, classes.

Mostly of pages are generated from database, so full text search on php files does not help me a lot.

Any tips / strategy about how to handle such a project ?

1
  • For whoever stumbles in this post and thinks that the require functions can be overridden (or in this case language constructs): no it won't work -> check comments here php.net/manual/en/function.override-function.php Commented Oct 5, 2015 at 10:29

2 Answers 2

3

https://secure.php.net/manual/en/function.get-included-files.php

This returns you a complete list of all files that are included or required on the current script. You can also use https://secure.php.net/manual/en/function.debug-backtrace.php which can give you useful debug information.

Also there are a host of built in PHP functions that feedback how a page is constructed, using the phrase "get defined..."

Sign up to request clarification or add additional context in comments.

Comments

0

Language constructs can't be extended so I'm afraid the quickest solution would be a quick search/replace on your project and use a different function defined by you:

function newRequireOnce($file){
  echo "\n".$file."\n";
  require_once $file;
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.