PHPDoc

Download php eBook

Syntax

  • @api
  • @author [name] [<email address>]
  • @copyright <description>
  • @deprecated [<"Semantic Version">][:<"Semantic Version">] [<description>]
  • @example [URI] [<description>]
  • {@example [URI] [:<start>..<end>]}
  • @inheritDoc
  • @internal
  • {@internal [description]}}
  • @license [<SPDX identifier>|URI] [name]
  • @method [return "Type"] [name](["Type"] [parameter], [...]) [description]
  • @package [level 1]\[level 2]\[etc.]
  • @param ["Type"] [name] [<description>]
  • @property ["Type"] [name] [<description>]
  • @return <"Type"> [description]
  • @see [URI | "FQSEN"] [<description>]
  • @since [<"Semantic Version">] [<description>]
  • @throws ["Type"] [<description>]
  • @todo [description]
  • @uses [file | "FQSEN"] [<description>]
  • @var ["Type"] [element_name] [<description>]
  • @version ["Semantic Version"] [<description>]
  • @filesource - Includes current file in phpDocumentor parsing results
  • @link [URI] [<description>] - Link tag helps to define relation or link between structural elements.

Remarks

"PHPDoc" is a section of documentation which provides information on aspects of a "Structural Element" — PSR-5

PHPDoc annotations are comments that provide metadata about all types of structures in PHP. Many popular IDEs are configured by default to utilize PHPDoc annotations to provide code insights and identify possible problems before they arise.

While PHPDoc annotations are not part of the PHP core, they currently hold draft status with PHP-FIG as PSR-5.

All PHPDoc annotations are contained within DocBlocks that are demonstrated by a multi-line with two asterisks:

/**
 *
 */

The full PHP-FIG standards draft is available on GitHub.

Related Examples

Stats

137 Contributors: 6
Monday, April 10, 2017
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook