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?
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.
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.
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.
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
Check out the PHPDoc.org @author tag.
Syntax
@author [name] [<email address>]
Examples
/**
* @author My Name
* @author My Name <[email protected]>
*/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With