PHP PHPDoc

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

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.



Got any PHP Question?