Previous Up Next
phpDocumentor Manual phpDocumentor Manual @abstract

phpDocumentor tags

How to use tags in DocBlocks

Gregory Beaver
Tag Documentation written by [email protected]
Copyright 2002, Gregory Beaver

Tags Manual

Welcome to the phpDocumentor Tags Manual

phpDocumentor tags are very similar to tags for the JavaDoc tool for Sun's Java Programming Language. Tags are only parsed if they are the first thing on a new line of a DocBlock. You may use the @ character freely throughout documents as long as it does not begin a new line. An example:

  1. /**
  2.  * tags demonstration
  3.  * @author this tag is parsed, but this @version tag is ignored
  4.  * @version 1.0 this version tag is parsed
  5.  */

Any tags that phpDocumentor does not recognize will not be parsed, and will be displayed in text flow as if they are part of the DocBlock long description. The example below displays text "tags demonstration @foobar this is silly," and also displays the author as "this tag is parsed, but this @version tag is ignored"

  1. /**
  2.  * tags demonstration
  3.  * @foobar this is silly
  4.  * @author this tag is parsed, but this @version tag is ignored
  5.  */

Inline tags display in the text flow where they appear, and are not separated from the description. As of version 1.2, there are several inline tags. The allowed inline tag list is different for tutorials and regular in-code documentation. See phpDocumentor Inline tags for more information.

The example below will display the text "this function works heavily with foo() to rule the world" where foo() represents a hyperlink that links to the function foo()'s documentation.

  1. /**
  2.  * inline tags demonstration
  3.  *
  4.  * this function works heavily with {@link foo()} to rule the world
  5.  */
  6. function bar()
  7. {
  8. }
  10. function foo()
  11. {
  12. }

Standard phpDocumentor Tags

Most tags can be in the DocBlock of any documentable PHP element (for a definition of a documentable PHP element, see Documentable PHP Elements). Here is a list of the standard tags:

Previous Up Next
phpDocumentor Manual phpDocumentor Manual @abstract

Documentation generated on Mon, 05 Dec 2011 21:18:36 -0600 by phpDocumentor 1.4.4