Use phpdoc/phpDocumentor to generate api documentation

Source: Internet
Author: User
PhpdocphpDocumentor is a very powerful automatic document generation tool that can help us compile standard comments and generate documents that are easy to understand and have a clear structure,

It is very helpful for code upgrades, maintenance, and handover.

Although many phpdoc documents are introduced on the Internet, it is a little troublesome:

1. there are too many content on the Internet, which is not easy for beginners to understand. I personally think that the tutorial should be simple and easy to understand. on the premise of being able to solve the problem, it can be as simple as possible.

More content should be in the form of an appendix, or leave other more detailed information links for readers to read (rather than copying a large part of the content into their own articles)

2. phpdoc installation is a little troublesome. They did not introduce a simple and easy-to-use method to readers.

3, phpdoc default encoding is ISO-8859-1, at this time the generated HTML document will be Chinese garbled. Is there a solution on the Internet ?? However, why not simply provide a version that supports Chinese characters?

Based on the above points, I want to write a blog post to share with you a simple method of using phpdoc (in windows)

Before using phpdoc, you must first understand the syntax rules of code comments (if you already know, ignore them ).

Refer to the description section on the annotation format in Wikipedia http://zh.wikipedia.org/wiki/PHPDoc.

Next, you can download the optimized phpdoc version:

Http://star7th-wordpress.stor.sinaapp.com/uploads/2013/04/phpdoc.zip

Download and decompress the package. for example, extract the package to the "D:/phpdoc" path.

Open phpdoc. bat in a text editor (note: do not double-click it to run it). Line 3:

SET phpCli = D: \ Program Files \ php5.3.11 \ php.exe

Change the php.exe path to the path of the php environment execution file on your computer. (If you are a PHPer, I believe you have installed the php environment on your computer .)

Then, open the command prompt. (Start-run-cmd), and enter the directory where phpdoc is located in the command line (for example, enter "cd D:/phpdoc ").

After entering the Directory, enter the following command to quickly generate the HTML document:

Phpdoc-d: \ website \ Api-t D: \ website \ Api \ doc-dn shilianwang-dc shilianwang-ti 文--o HTML: Smarty: PHP

In the preceding command, D: \ website \ Api is the directory where the source PHP file is located. D: \ website \ Api \ doc is the directory for generating documents.

Shilianwang is a subdirectory, package, and title. HTML: Smarty: PHP indicates HTML module generation

For more information about the above commands, enter phpdoc-h in the command line.

Finally, three types are attached:

Annotation style:

Generated by this annotation:



PhpDocumentor manual-installation and label use

Thank you for following the websites blog!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.