You are here:Home arrow Home arrow PHP arrow Little PHPDoc and SVN Integration
  • Narrow screen resolution
  • Wide screen resolution
  • Decrease font size
  • Default font size
  • Increase font size
  • default color
  • green color
  • blue color

Little PHPDoc and SVN Integration

Thursday, 05 November 2009

Ever looked through the Zend Framework code and saw header comments like this?

<?php
/**
* @version $Id: Exception.php 16200 2009-06-21 18:50:06Z thomas $
**/

Here is a quick tip on how this can be useful and how to have this type of integration in your projects.

On a large project where many people are working on multiple files, using Subversion for version control system is a common choice. The Subversion (or SVN for short) allows to set keywords on files or directories, effectively allowing people to tag files with some useful information. Another feature is the keywords which are automatically substituted by the client software.

Some of these keywords are Id and LastChangedBy. If you set LastChangedBy keyword on file, and place text $Author$ anywhere in the file contents, the client software would expand the text with keyword value like this:

$Author: danila$

If you are running Eclipse with Subversive plugin for SVN integration, you will get a Team -> Set Keywords command available via right click on a file or folder. This will allow you to add keywords on files. After that you will have to add them directly to file contents.

PHPDoc has some keywords as well: @author and @version. You can benefit from PHPDoc + SVN integration by setting Author and LastChangedBy keywords on files and adding them to PHPDoc section of your PHP files.

<?php
/**
* @version $Id$
* @author $Author$
**/

Thus, after updating files from SVN, developers can see the versioning/last changed author when opening files and PHPDoc will generate documentation that reflects SVN information.





Reddit!Del.icio.us!Facebook!Slashdot!Netscape!Technorati!StumbleUpon!
Last Updated ( Thursday, 05 November 2009 )

Add comment


Security code
Refresh

< Prev   Next >