LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

phpdoc

generates API documentation from PHP source code

TLDR

Generate documentation
$ phpdoc -d [src/] -t [docs/]
copy
Specify config file
$ phpdoc -c [phpdoc.xml]
copy
Generate with specific template
$ phpdoc -d [src/] -t [docs/] --template="clean"
copy
Parse single file
$ phpdoc -f [file.php] -t [docs/]
copy

SYNOPSIS

phpdoc [options]

DESCRIPTION

phpDocumentor (phpdoc) generates API documentation from PHP source code. It parses DocBlock comments to create navigable HTML documentation. The default command is `phpdoc run`, which can also be invoked simply as `phpdoc`. It supports configuration files (phpdoc.xml or phpdoc.dist.xml) for persistent settings and multiple output templates.

PARAMETERS

-d, --directory path

Source directory.
-f, --filename file
Single file to parse.
-t, --target path
Output directory.
-c, --config file
Configuration file.
--template name
Template to use.
--ignore pattern
Patterns to ignore (supports globs, e.g., `"**/*test.php"`).
--visibility level
Filter by visibility: public, protected, private, api, or internal.
--title text
Set browser and template title.
--encoding encoding
Set file encoding (default: UTF-8).

DOCBLOCK FORMAT

$ /**
 * Short description.
 *
 * Long description.
 *
 * @param string $name The name
 * @return bool Success status
 * @throws Exception On failure
 */
copy

CONFIGURATION (phpdoc.xml)

$ <?xml version="1.0"?>
<phpdocumentor>
    <paths>
        <output>docs</output>
    </paths>
    <source>
        <path>src</path>
    </source>
</phpdocumentor>
copy

CAVEATS

Requires proper DocBlocks. Large projects take time to process. Template quality varies.

HISTORY

phpDocumentor was created by Joshua Eichorn and is now maintained by Mike van Riel and the community.

SEE ALSO

doxygen(1), php(1), composer(1), phpunit(1)

Copied to clipboard
Kai