Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mapping PHP script and file dependency structure

Tags:

php

I have recently become an intern on a startup online classroom system. So now, I'm scrambling to learn the system, and get to know the code for the program, which is written in PHP. This program spans around 3000 PHP files and associated images, html pages, CSS files and so forth, across over a hundred folders.

I was wondering if there was some program or utility that could parse the files and directories and create a map of sorts, showing which PHP files include which other files, so that I could see quickly which files and scripts are no longer in use or obsolete, and which files depend on other files, and so forth. In other words, I can see the file and directory structure. I would now like to see the dependency structure, in terms of includes. Without having to open each file individually and track down the includes statements.

Any help would be appreciated!

like image 560
Anthony Fisher Avatar asked Jul 09 '10 01:07

Anthony Fisher


People also ask

What is php file structure?

1.2. Structure of a PHP Script. PHP is an embedded scripting language when used in Web pages. This means that PHP code is embedded in HTML code. You use HTML tags to enclose the PHP language that you embed in your HTML file — the same way that you would use other HTML tags.

Are php files scripts?

PHP is a server-side scripting language which is mostly used to build web-based applications. These may range from a very simple blog to a full-fledged eCommerce website. In fact, PHP is one of the most popular server-side scripting languages for web development.


1 Answers

It's not exactly what you want, but the "inclued" PECL extension is almost certainly going to help you. It works on a per-request basis, and maps out the file inclusion chain. It can even make pretty graphs!

Because it works on a request basis, unfortunately it can't map out your entire codebase for you.

like image 139
Charles Avatar answered Oct 27 '22 03:10

Charles