views:

293

answers:

4

I've always seen these header comments in php, and often wondered if some software was used to set them up? I seem to recall JavaDoc or something? But I'm not sure if this is auto generated? Or is this just some type of documentation standard?

The example below is from CodeIgniter:

/**
 * CodeIgniter
 *
 * An open source application development framework for PHP 4.3.2 or newer
 *
 * @package  CodeIgniter
 * @author   ExpressionEngine Dev Team
 * @copyright   Copyright (c) 2008, EllisLab, Inc.
 * @license  http://codeigniter.com/user_guide/license.html
 * @link     http://codeigniter.com
 * @since    Version 1.0
 * @filesource
 */

I would really like to improve my commenting and I feel this would be a great form for my projects.

A: 

This is JavaDoc and it's probably autogenerated by an IDE.

zzandy
+3  A: 

It's phpDoc which is used by some frameworks with reflection to dynamically understand and use classes (by the code itself).

IDEs will also use it for autocomplete, showing function arguments, etc. Good thing to know if your IDE provides those function for the Framework your using, but not the code you write.

PHP's Reflection API

Zend Framework Extension (including DocBlocks)

CodeIgniter's Comment Guide (Using DocBlock '...so they can be picked up by IDEs')

DocBlock Description on phpdoc.org (linked from CI's Style Guide)

Tim Lytle
Added a few links of examples/documentation.
Tim Lytle
+1  A: 

Some IDE's can put it in automatically, but people often just type it in.

For PHP it's PHP Documentor, you can see a quickstart guide here.

This will scan your source code and create documentation based on your comments on your files, classes and functions.

dprevite
A: 

These comments follow the standard of phpdoc and can be used to automatically generate a documentation for your code. You can see an example of such a documentation here.

While some IDEs have support to make writing them easier, the actual content is handwritten by the programmers.

michaelk