LinuxCommandLibrary

doctum

Generate documentation from code differences

TLDR

Parse a project

$ doctum parse
copy

Render a project
$ doctum render
copy

Parse then render a project
$ doctum update
copy

Parse and render only a specific version of a project
$ doctum update --only-version=[version]
copy

Parse and render a project using a specific configuration
$ doctum update [path/to/config.php]
copy

SYNOPSIS

doctum parse|render|update CONFIG OUTPUT_DIR [--force] [--dry-run] [--assets-only]

PARAMETERS

parse|render|update
    Subcommand: parse scans sources and builds cache; render generates HTML from cache; update runs both.

CONFIG
    Path to PHP configuration file defining projects, title, paths, and options.

OUTPUT_DIR
    Target directory for generated documentation.

--force
    Overwrite existing cache/output even if unchanged.

--dry-run
    Simulate run without writing files.

--assets-only
    Copy only assets (CSS/JS/images), skip parsing/rendering.

-h, --help
    Display help.

-V, --version
    Show version.

DESCRIPTION

Doctum is a high-performance documentation generator for PHP projects, forked from Sami with significant enhancements for speed and robustness. It scans PHP source code to extract docblocks, classes, interfaces, traits, functions, and more, producing static HTML documentation sites.

Key features include support for PHP 8+ attributes, advanced cross-referencing, customizable templates, remote repository integration for GitHub/GitLab, and partial builds for incremental updates. It excels in large codebases by leveraging caching and parallel processing.

Unlike phpDocumentor, Doctum focuses on API docs with a modern, searchable interface. Install via Composer (composer req --dev doctum/doctum) or PHAR. Configure via PHP script defining projects, paths, and options, then run CLI to parse, render, or update docs. Ideal for open-source libraries and enterprise apps needing reliable, up-to-date API references.

CAVEATS

Requires PHP 8.1+; config must return a Doctum instance. Large projects may need memory tweaks (php -d memory_limit=2G doctum ...). No built-in support for non-PHP langs.

INSTALLATION

composer require --dev doctum/doctum
Or download PHAR: php doctum.phar

BASIC CONFIG EXAMPLE

doctum.php:
return new Doctum\Doctum($path, new Doctum\Renderer\PhpRenderer($path));
Configurable via title(), addProject(), etc.

HISTORY

Originated as Sami (2011) by Fabien Potencier (Symfony creator). Doctum forked in 2020 by staabm for better maintenance, PHP 8 support, and performance (up to 10x faster via better caching). Actively developed on GitHub.

SEE ALSO

php(1), doxygen(1), phpdoc(1)

Copied to clipboard