soundasleep/phpdoc2

该软件包最新版本(0.4.0)没有提供许可证信息。

解析PHP文档块并生成HTML输出

0.4.0 2015-05-06 03:47 UTC

This package is auto-updated.

Last update: 2024-09-14 09:55:18 UTC


README

soundasleep/phpdoc2 是另一个PHP文档生成器,但试图比现有解决方案更简洁、更智能、更易于扩展。

例如,使用PHPDoc注释块标记你的类和方法

namespace Openclerk\Currencies;

/**
 * A "currency" represents some unit of measurement that can
 * be converted into another "currency" unit, e.g. through an {@link Exchange}.
 * Can also cover commodities.
 *
 * This is the base interface; other interfaces will provide additional
 * functionality as necessary.
 */
interface Currency {

  /**
   * Get the unique three-letter currency code for this currency,
   * e.g. 'btc' or 'usd'. Must be lowercase. This is not visible to users.
   */
  public function getCode();

  /**
   * @return true if this can be considered a "cryptocurrency", e.g. "btc"
   */
  public function isCryptocurrency();

  // ...
}

使用

php -f phpdoc2.php -- --directory "src/" --output "docs/"

为了方便生成文档,你可以使用带有 grunt-phpdoc2 任务的Grunt。例如,查看 phpdoc2-openclerk 提供的示例Gruntfile。

模板

要覆盖或扩展这些模板,请添加 --templates "dir"。生成器将添加此目录以覆盖默认模板。使用 openclerk/pages,这意味着你可以调用子模板。

演示

支持的最高级标签

  • @throws (类) (描述)
  • @param $name (描述)
  • @return 描述
  • @see (类) (描述)
  • @deprecated (描述)

支持的行内标签

  • {@link http://foo.com}
  • {@link 类}{@link #方法}{@link 类#方法}{@link 类 描述}{@link 复数}s
  • {@code ...}

TODO

  • 查看与 phpdoc PSR标准参考PSR示例 的兼容性
  • 方法和类摘要应仅显示 '标题' 文档的第一句话
  • 突出显示抽象类
  • 在抽象类上显示继承的抽象方法
  • @author 标签
  • @since 标签
  • @var 标签
  • @inheritDoc 行内标签 - 可能有些棘手
  • 类变量
  • 类常量
  • 支持全局函数
  • 支持全局常量
  • issue #123 提供链接到外部问题跟踪器的选项
  • 为composer项目链接到开源项目
  • 为GitHub项目链接到源代码

另请参阅