Using Phpdoc/phpdocumentor to generate API documentation

Source: Internet
Author: User
Phpdocumentor is a very powerful document auto-generation tool that helps us to write specification annotations, generate easy-to-understand, structured documents,

For our code upgrade, maintenance, handover, etc. have very great help.

The online document about Phpdoc, though a lot, but a bit of trouble:

1, the Internet is usually introduced too much content, not easy to be read by novice. Personally, the tutorial should be simple and easy to understand, in the premise of solving the problem, how simple it can be.

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

2, Phpdoc installation a little trouble. They did not introduce a simple and easy way to the reader

3, Phpdoc The default encoding is Iso-8859-1, at this time the generated HTML document will be garbled in Chinese. Although there is a solution available on the Internet?? But why not just provide a version that supports Chinese to the reader?

Based on the above, I would like to write a blog post to share with you a simple way to use Phpdoc (in Windows environment)

Before using Phpdoc, you first need to understand the syntax rules of the code comments (if you already understand them, please ignore them).

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

Next, you can download this optimized version of Phpdoc:

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

After downloading, decompression, for example, to "D:/phpdoc" path.

Open Phpdoc.bat with a text editor (note, not double-click Run), line 16th:

SET Phpcli=d:\program Files\php5.3.11\php.exe

Change the path of the PHP.exe here to the path where your computer's PHP environment executes the file. (If you are phper, I believe you have installed a PHP environment in this machine.) )

Then, open a command prompt. (Start-run-cmd), on the command line, enter the directory where Phpdoc is located, (for example, enter "CD D:/phpdoc").

After entering the directory, you can quickly generate an HTML document by entering the following command:

phpdoc-d D:\website\Api-t D:\website\Api\doc-dn shilianwang-dc shilianwang-ti Internet of Things document-O HTML:Smarty:PHP

In the above command, D:\WEBSITE\API is the directory where the source PHP file resides. D:\website\Api\doc is the generated document storage directory.

Shilianwang is a subdirectory, package, title. HTML:Smarty:PHP represents the use of HTML modules to generate

Above command, if you want to know more, you can enter phpdoc-h at the command line to learn more.

Finally, three types are attached:

Style of comment:

This comment generates:



Phpdocumentor Manuals-Installation and label use

Thank you for your attention websites blog!

  • 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.