How to use phpDoc to document software modules?
At YetAnotherCommunitySystem we have adopted phpDoc from the beginning as the tool of choice for software documentation. You can see the result at the scripts index.
Each time the set of reference scripts is rebuilt (scripts/build.php) the entire phpDoc documentation is rebuilt as well. To achieve this, every running script is parsed and analyzed.
Comments are filtered and combined in order to provide following items:
- the index page itself, at scripts/index.php
- the to-do list, at scripts/view.php/todo
- the authors page, at scripts/view.php/authors
- the testers page, at scripts/view.php/testers
- the license page, at scripts/view.php/licenses
The last four links are available at the top of the index page for scripts.
*
@todo to remind on things to do*
@author and @tester to reward contributors*
@see to cross-link to the documentation page of another software module*
@license to bind a software module to a license (e.g., LGPL)*
@link to link software modules to any external page on the Internet*
@reference to signal a script to be included in the reference setOf course, HTML tags can be used into script comments. However, the preferred solution to beautify text is to embed YACS codes when necessary.
Example from services/blog.php:
codes::render_pre_php
Also, each documentation page has links to browse or to fetch the script itsef. Here, browse means "read the target script in a pretty format", where fetch means "download and display the script itself".
For example, you can take a look at the back-end script used to support w.bloggar at the following address: scripts/view.php/services/blog.php. You will note the additional links under the main title to browse and to fetch the script.