apigen/apigen

PHP 源代码 API 生成器。

维护者

详细信息

github.com/apigen/apigen

源代码

问题

安装量: 611,929

依赖者: 263

建议者: 6

安全: 0

星星: 2,158

关注者: 103

分支: 309


README

ApiGen 是一个易于使用且现代化的 API 文档生成器,支持所有 PHP 8.2 特性。

特性

建立在巨人的肩膀之上

安装

使用 Docker

ApiGen 可作为 apigen/apigen Docker 镜像直接使用。

docker run --rm --interactive --tty --volume "$PWD:$PWD" --workdir "$PWD" \
  apigen/apigen:edge \
  src --output docs

使用 Phar

这将安装 ApiGen Phar 二进制文件到 tools/apigen

mkdir -p tools
curl -L https://github.com/ApiGen/ApiGen/releases/latest/download/apigen.phar -o tools/apigen
chmod +x tools/apigen
tools/apigen src --output docs

使用 Composer

这将安装 ApiGen 到 tools/apigen 目录,其中在 tools/apigen/bin/apigen 中有可执行的入口点。

composer create-project --no-dev apigen/apigen:^7.0@alpha tools/apigen
tools/apigen/bin/apigen src --output docs

用法

通过传递源目录和目标选项生成 API 文档

apigen src --output docs

配置

ApiGen 可以通过 apigen.neon 配置文件进行配置。

parameters:
  # string[], passed as arguments in CLI, e.g. ['src']
  paths: []

  # string[], --include in CLI, included files mask, e.g. ['*.php']
  include: ['*.php']

  # string[], --exclude in CLI, excluded files mask, e.g. ['tests/**']
  exclude: []

  # bool, should protected members be excluded?
  excludeProtected: false

  # bool, should private members be excluded?
  excludePrivate: true

  # string[], list of tags used for excluding class-likes and members
  excludeTagged: ['internal']

  # string, --output in CLI
  outputDir: '%workingDir%/api'

  # string | null, --theme in CLI
  themeDir: null

  # string, --title in CLI
  title: 'API Documentation'

  # string, --base-url in CLI
  baseUrl: ''

  # int, --workers in CLI, number of processes that will be forked for parallel rendering
  workerCount: 8

  # string, --memory-limit in CLI
  memoryLimit: '512M'