PHPDoc 文档生成器在 Eclipse 中还是在 Eclipse 之外?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1184627/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 13:55:00  来源:igfitidea点击:

PHPDoc documentation generator in or out of Eclipse?

phpeclipsedocumentationphpdoc

提问by AlexA

I am developing with Eclipse + PDT. I've been adding phpdoc comments into my code, but actually never generated a resulting documentation in Eclipse. How should I do it - is there some functionality in Eclipse, or doc generation should be done externally?

我正在使用 Eclipse + PDT 进行开发。我一直在我的代码中添加 phpdoc 注释,但实际上从未在 Eclipse 中生成结果文档。我应该怎么做 - Eclipse 中是否有一些功能,或者文档生成应该在外部完成?

采纳答案by Pascal MARTIN

To generate the documentation, you should use phpDocumentor, which can be installed as a PEAR package.

要生成文档,您应该使用phpDocumentor,它可以作为 PEAR 包安装。

Then, you have to call it from command-line ; I've never seen it called from Eclipse PDT, actually.

然后,您必须从命令行调用它;实际上,我从未见过它从 Eclipse PDT 调用。

A great solution is to have a continuous-integration platform (using phpUnderControl, for instance), and integrate to creation of the phpdoc in your build configuration file ; this way, the phpdoc is generated everytime someone commits (or once a day, or whenever you want ^^ ).

一个很好的解决方案是拥有一个持续集成平台(例如,使用phpUnderControl),并将其集成到构建配置文件中的 phpdoc 的创建中;这样,每次有人提交(或每天一次,或每当您想要 ^^ 时)都会生成 phpdoc 。

In Eclipse PDT, you can call "external tools" (see "Run > External Tools" in the menu) ; this would allow you to launch the phpdoc command (like you do from CLI) ; but it definitly is not as user-friendly as what Zend Studio offers -- not the same price either, though ^^

在Eclipse PDT中,您可以调用“外部工具”(参见菜单中的“运行>外部工具”);这将允许您启动 phpdoc 命令(就像您在 CLI 中所做的那样);但它绝对不像 Zend Studio 提供的那样用户友好——虽然价格也不一样^^

回答by Davide Pastore

Another great tool to generate documentation is ApiGen. It doesn't need installation with PEAR (but includes it) and it can be used like a standalone package.

另一个生成文档的好工具是ApiGen。它不需要与 PEAR 一起安装(但包括它),并且可以像独立包一样使用。

回答by Rich Seller

Yes there is a wizard to do this in Zend. Check out this brief guide.

是的,Zend 中有一个向导可以执行此操作。查看此简要指南

Alternatively you can create an external launch configuration to invoke the standard phpDocumentor.

或者,您可以创建一个外部启动配置来调用标准phpDocumentor

  1. Select Run->External Tools->External Tools Configurations...
  2. In the left hand pane, select Program then the new icon (left-most icon above the pane).
  3. In the right hand pane, select the Main tab.
  4. Enter generate_doc in the Name: field.
  5. Enter the path to the phpdoc cli tool in the Location: field.
  6. Enter any required arguments in the Arguments field, e.g. for the current project input ${project_loc}.
  7. To run the external configuration, select Run.
  1. 选择运行->外部工具->外部工具配置...
  2. 在左侧窗格中,选择程序,然后选择新图标(窗格上方最左侧的图标)。
  3. 在右侧窗格中,选择 Main 选项卡。
  4. 在名称:字段中输入 generate_doc。
  5. 在位置:字段中输入 phpdoc cli 工具的路径。
  6. 在参数字段中输入任何必需的参数,例如用于当前项目输入 ${project_loc}。
  7. 要运行外部配置,请选择运行。

To rerun the configuration you have a few choices:

要重新运行配置,您有几个选择:

  1. Select the External Tools icon from the menu bar external tools icon http://help.eclipse.org/ganymede/topic/org.eclipse.cdt.doc.user/images/icon%5Fext%5Ftools.png"then click generate_doc
  2. Select Run->External Tools->generate_doc
  3. Hit Alt+R, E, 1 (assuming generate_doc is the first item in the list, otherwise pick the appropriate number)
  1. 从菜单栏中选择外部工具图标外部工具图标 http://help.eclipse.org/ganymede/topic/org.eclipse.cdt.doc.user/images/icon%5Fext%5Ftools.png"然后点击 generate_doc
  2. 选择运行->外部工具->generate_doc
  3. 按 Alt+R, E, 1 (假设 generate_doc 是列表中的第一项,否则选择适当的数字)