PHPDoc is an adaptation of
Javadoc
Javadoc (originally cased JavaDoc) is a documentation generator created by Sun Microsystems for the Java language (now owned by Oracle Corporation) for generating API documentation in HTML format from Java source code. The HTML format is used ...
for the
PHP
PHP is a General-purpose programming language, general-purpose scripting language geared toward web development. It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1993 and released in 1995. The PHP reference implementati ...
programming language
A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language.
The description of a programming l ...
. It is still an informal standard for
commenting PHP code, but it is in the process of being formalized.
[PHP-FIG: PSR Working Draft - https://github.com/php-fig/fig-standards/blob/master/proposed/phpdoc.md] It allows external document generators like
phpDocumentor
phpDocumentor is an open-source documentation generator written in PHP. It automatically parses PHP source code and produces readable API and source code documentation, based on PHPDoc-formatted comments and the structure of the source code ...
, which is the de facto standard implementation,
to generate documentation of
APIs
Apis or APIS may refer to:
* Apis (deity), an ancient Egyptian god
* Apis (Greek mythology), several different figures in Greek mythology
* Apis (city), an ancient seaport town on the northern coast of Africa
**Kom el-Hisn, a different Egyptian ci ...
and helps some
IDEs such as
Zend Studio
Zend Studio is a commercial, proprietary integrated development environment (IDE) for PHP developed by Zend Technologies, based on the PHP Development Tools (PDT) plugin for the Eclipse platform (the PDT project is led by Zend).
Zend Studio is t ...
,
NetBeans
NetBeans is an integrated development environment (IDE) for Java. NetBeans allows applications to be developed from a set of modular software components called ''modules''. NetBeans runs on Windows, macOS, Linux and Solaris. In addition to Java ...
,
JetBrains PhpStorm,
ActiveState Komodo Edit and IDE,
PHPEdit
PHPEdit is a commercial IDE developed by the French company WaterProof SARL. It runs on the Microsoft Windows operating system, and is designed mainly for the PHP language, but supports many other languages such as CSS, HTML, JavaScript, INI, P ...
and
Aptana Studio
Aptana, Inc. is a company that makes web application development tools for use with a variety of programming languages (such as JavaScript, Ruby, PHP and Python). Aptana's main products include Aptana Studio, Aptana Cloud and Aptana Jaxer.
Aptan ...
to interpret variable types and other ambiguities in the
loosely typed language and to provide improved
code completion
Autocomplete, or word completion, is a feature in which an application predicts the rest of a word a user is typing. In Android and iOS smartphones, this is called predictive text. In graphical user interfaces, users can typically press the tab ...
, type hinting and debugging.
PHPDoc supports documentation of both
object-oriented
Object-oriented programming (OOP) is a programming paradigm based on the concept of " objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of ...
and
procedural
Procedural may refer to:
* Procedural generation, a term used in computer graphics applications
*Procedural knowledge, the knowledge exercised in the performance of some task
* Procedural law, a legal concept
*Procedural memory, a cognitive scienc ...
code.
On August 13, 2013 the PHP Framework Interoperability Group began writing a formal specification (PSR) for PHPDoc.
Example
/**
* Get all image nodes.
*
* @param \DOMNode $node The \DOMDocument instance
* @param boolean $strict If the document has to be valid
*
* @return \DOMNode
*/
public function getImageNodes(\DOMNode $node, $strict = true): \DOMNode
{
// ...
}
See also
*
phpDocumentor
phpDocumentor is an open-source documentation generator written in PHP. It automatically parses PHP source code and produces readable API and source code documentation, based on PHPDoc-formatted comments and the structure of the source code ...
*
Doxygen
Doxygen ( ) is a documentation generator and static analysis tool for software source trees. When used as a documentation generator, Doxygen extracts information from specially-formatted comments within the code. When used for analysis, Doxyge ...
*
Comparison of documentation generators
The following tables compare general and technical information for a number of documentation generators. Please see the individual products' articles for further information. Unless otherwise specified in footnotes, comparisons are based on the ...
References
External links
phpDocumentor.org
Documentation generators
PHP software