Developer News: Easy Referencing for PHP FilesPosted by: Roosteron 2003/5/6 21:10:34 4739 reads Hello, all. Just a sharing note. This weekend, I had a need for a script that could quickly parse files from a PHP-scripted application for an article I'm working on into a tree for viewing and analysis purposes. Consequently, I downloaded and installed a SourceForge project called PHPXref.
PHPXref does exactly what I was looking for. It parses a directory tree of PHP files and extracts suitably formatted comments placed in the scripts to generate a cross-referenced tree of HTML files and documentation that can be viewed using any Web browser, with or without a Web server.
Unfortunately, the script did not function as designed on my Windows development machine without some tweaking. That's why I'm sharing, because if you are not familiar with PHPXref, then you might find it of some use in your own work or in administering your site.
What are PHPXref core features?
[*] Generates plain HTML output that can be viewed with any Web browser and downloaded onto the local machine for quick reference or shared across the Web with others.
[*] Creates links to the source code of all files in a tree for viewing by line number.
[*] Cross-references functions, variables, include() and require()'d files and SQL table usage.
[*] Produces complete linkages to functions, variables, and, optionally, a table list.
[*] Contains a lookup engine to quickly find a function, variable, or table.
[*] Creates a left-side navigation frame that can be turned on or off, as well as the traditional tree menu view for easy navigation.
How can PHPXref be used?
The short answer is for many purposes other than what it was intended. Because PHPXref provides an easy means of viewing and documenting PHP files, it means that
[*] you can manage your own PHP scripts while you code for these purposes.
[*] it can be used efficiently by programmers who are collaborating remotely to simultaneously view the same file online outside of a text editor so as to make comments and changes in near real-time if they sync the appropriate technologies together (FTP, email, portal, CVS, etc. ).
[*] PHPXref can be used in technical support forums when references to specific lines of code to assist users is required so that both helper and user can view the same spec.
[*] assist you in better managing your XOOPS site. Have a problem, reference your exact code easily without cutting and pasting.
These are just a few uses. I'm sure you can think of others. To see the script in action, visit PHPXref's SourceForge project page, where the script was run on the SourceForge PHP Source files. You can view the results there to see what the output looks like, as well as download a Linux version of the script.
For my Windows mod, you can download here and now. This DL contains the original files, plus the Windows32 files, which are designated with a -win32 notation in the file name. Enjoy!