..a dose of zero-day know-hows ..

5/03/2010

Using PHPXref

PHPXref is a PHP cross referencing documentation generator designed to make it easier for developers to browse a PHP application's codebase. With features such as mouse-over information and hot-jumping among classes and functions and extraction of phpdoc style documentation, it really does simplify a job of a developer in getting to know a new application.

It requires Perl to be installed since it uses a perl-based script to parse the source directory to generate a documentation. You may download the right version of Perl for your platform here.

Using PHPXref to generate a cross referencing documentation of any application is easy, assuming you already have Perl installed, just follow these 5 simple steps.

Step 1.) Download PHPXref from http://phpxref.sourceforge.net/#download (choose the version suited for your platform).

wget http://prdownloads.sourceforge.net/phpxref/phpxref-0.7.tar.gz?download

Step 2.) Uncompress the downloaded phpxref archive

tar xvpf phpxref-0.7.tar.gz

Step 3.) Navigate to the extracted folder and edit the file named phpxref.cfg. Edit the values for the SOURCE, OUTPUT and PROJECT as needed.


(NOTE: You may need to create the directory for the OUTPUT if it doesn't exist yet to prevent runtime errors during generation as the phpxref script will not create it for you.)

Step 4.) Run the phpxref generation script by invoking the following command:

./phpxref.pl



Step 5.) Once generated, you may now browse the generated documentation in HTML format. If you have set the OUTPUT to point within your Document Root as with our example above, you may browse it using http://localhost/phpxref_sugarcrm or directly in its location since the generated doc is static.



You may automate this process to keep the cross referencing documentation up to date by regularly running phpxref.pl via cron.

1 comment:

Roger Springer said...

Thanks for sharinng