Search code examples
phpheadercommentsstandards

PHP Standard author header comments


What is the format I should use for PHP header comments?

Is this the same for PEAR as found here http://pear.php.net/manual/en/standards.header.php?

What should be contained?

<?php

/**
 * database.php
 *
 * Database access
 *
 * @category   CategoryName
 * @package    PackageName
 * @author     Mike
 * @copyright  2013 Mike
 * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
 * @version    CVS: $Id:$
 * @link       http://pear.php.net/package/PackageName
 * @see        NetOther, Net_Sample::Net_Sample()
 * @since      File available since Release 1.2.0
 * @deprecated File deprecated in Release 2.0.0
 */

?>

Could someone please explain what each of these actually mean other than the author and copyright.

Does entering the version number here do anything other than show the programmer? Can it be used by the system itself?

@package and @category What do these two do? And again, are they used by the system or is it purely for the programmer?


Solution

  • Check out the PHPDoc documentation. It contains explanations of all of the tags.

    phpDocumentor 3.0
    https://docs.phpdoc.org/3.0/guide/references/phpdoc/tags/index.html