Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 917
Michael Avatar asked Oct 02 '13 05:10

Michael


People also ask

How are comments written in PHP?

Single-line PHP Comments To leave a single-line comment, type two forward slashes (//) followed by your comment text. All text to the right of the // will be ignored. You can also use a hash symbol (#) instead of // to make a single-line comment.

What should be in a header PHP?

Before HTML, XML, JSON, or other output is given to a browser or client, the server sends raw data as header information with the request (particularly HTTP Request). Headers in PHP contain additional details about the object delivered in the message body, as well as the request and response.

Why is my PHP code commented out?

So because PHP tags are not valid in HTML files, when not preprocessed by the server, the browser doesn't recognise it, so it automatically converts it to comments since it doesn't know what else to do with it.


2 Answers

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

like image 169
Chokchai Avatar answered Sep 18 '22 11:09

Chokchai


Check out the PHPDoc.org @author tag.

Syntax

@author [name] [<email address>]

Examples

 /**
  * @author My Name
  * @author My Name <[email protected]>
  */
like image 24
Faisal Avatar answered Sep 18 '22 11:09

Faisal