Generates API documentation by parsing PHP source files.
Scans a source tree, builds an index of discovered namespaces and symbols, then renders documentation output using Smarty templates in markdown or index formats.
public const DOC_OUTPUT_HTML = 1
public const DOC_OUTPUT_MARKDOWN = 2
public const DOC_OUTPUT_INDEX = 3
Selected documentation output format.
private int $outputFormat
Destination directory or file path for rendered output.
private string $outputPath
Source file or directory path to scan for PHP symbols.
List of files that encountered errors during parsing.
private array $fileErrors
Creates a documentation generator instance.
public __construct(int $outputFormat, ?string $title): void
| Parameter | Type | Description |
|---|
$outputFormat | int | output mode constant |
$title | string | optional documentation title |
Sets a callback for progress and status log messages.
public setCallback(\Closure $callback): void
| Parameter | Type | Description |
|---|
$callback | \Closure | callback that receives log text |
Sets the source path to scan.
public setScanPath(string $scanPath): bool
| Parameter | Type | Description |
|---|
$scanPath | string | source file or directory |
Sets the output destination path.
public setOutputPath(string $outputPath): void
| Parameter | Type | Description |
|---|
$outputPath | string | directory or file target for rendered docs |
Gets the configured output destination path.
public getOutputPath(): string
Scans source files and renders API documentation output.
public generateIndex(string $style = 'vuepress'): bool
| Parameter | Type | Description |
|---|
$style | string | |
private render(\stdClass $index, string $outputPath): bool
| Parameter | Type | Description |
|---|
$index | \stdClass | |
$outputPath | string | |
private renderNamespace(\stdClass $namespace, array $subdirs, array $template): void
| Parameter | Type | Description |
|---|
$namespace | \stdClass | |
$subdirs | array | |
$template | array | |
private loadTemplates(string $path, int $outputFormat = 2): void
| Parameter | Type | Description |
|---|
$path | string | |
$outputFormat | int | |
private updateIndex(\stdClass $index, ParserFile $parsedFile): void
| Parameter | Type | Description |
|---|
$index | \stdClass | |
$parsedFile | ParserFile | |
private pushIndexItem(array $array, array $items): void
| Parameter | Type | Description |
|---|
$array | array | |
$items | array | |
private getFiles(string $path): void
| Parameter | Type | Description |
|---|
$path | string | |
private postProcessRemoveEmptyLines(string $content): string
| Parameter | Type | Description |
|---|
$content | string | |
private postProcessReplaceClassLinks(string $content): string
| Parameter | Type | Description |
|---|
$content | string | |
private log(string $message): void
| Parameter | Type | Description |
|---|
$message | string | |
private createNamespaceHierarchy(\stdClass $item): void
| Parameter | Type | Description |
|---|
$item | \stdClass | |
Generated by Hazaar API Doc Generator on Tue, 21 Apr 2026 04:00:25 +0000