Automatic PHP Documentation Generation? [closed]

我与影子孤独终老i 提交于 2019-11-28 03:20:21

ApiGen

http://apigen.org/

ApiGen has support for PHP 5.3 namespaces, packages, linking between documentation, cross referencing to PHP standard classes and general documentation, creation of highlighted source code and experimental support for PHP 5.4 traits.

DocBlox

http://www.docblox-project.org/

PHP 5.3 compatible API Documentation generator aimed at projects of all sizes and Continuous Integration.

able to fully parse and transform Zend Framework 2

Pascal MARTIN

There are two well-known and often-used tool that can generate API doc from docblocks :

  • phpDocumentor, which is specific to PHP, and is probably one of the most used tool for PHP projects
  • and Doxygen, which is more for C, but is used for PHP by some people.


About the "guidelines" : I would say it depends on your projects, but, at least, I would expect to see :

  • a description of what the method/function does
  • parameters, with @param type name description of the parameter
  • return value, with @return type description of the return value
  • exceptions, with @throws type description of the exception that can be thrown

A great thing being that recent IDE (like Eclipse PDT, for instance), can read and interpret those markers, to provide hints when you're coding ;-)


Also, there are more and more PHP tools that use php docblocks for some other purpose than documentation.

For instance, PHPUnit allows you to specify some test-related stuff using some specific tags -- see Annotations.

PHPDoc is probably as good as you'll get it in terms of Javadoc style inline commenting. You might also want to look at PHPXRef.

Yes, phpDocumentor (http://www.phpdoc.org/) is an acceptable standard tool for PHP autodocs. It's the de-facto standard.

It's acceptable to follow the general JavaDoc guidelines for code when documenting PHP code. However, you're going to run into cases where that's not enough because PHP and Java are different languages.

For example, PHP functions have no return type and it's inevitable (and sometimes desirable) for a function to return one type with one context, and another type with in a second context. JavaDoc guidelines aren't going to help with that, because it's impossible to do in Java.

phpDocumentor can output in a style similar to the php.net documentation (and its built in with both smarty and non smarty layouts)

Check out PHPDoctor http://peej.github.com/phpdoctor/, a simple yet full features Javadoc clone for PHP.

The Wordpress code-base is documented using phpdoc tags (see this) and it's generally pretty good - it's rendered here using phpDocumentor.

Most of the code that I write that's substantial enough that I need to think about autogenerating docs for is done in .Net, so I can't give much of a documentation writer's perspective though

If ugly's a problem, I'd just switch the stylesheet for a custom one. If you don't want to overwrite the generated one, you can use a Firefox plugin like Stylish.

You could edit the template file to add your own stylesheet to override the existing one.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!