Phpdocumentor Introduction
Phpdocumentor is a php-written tool for PHP programs with canonical annotations that can quickly generate API documentation with cross-referencing, indexing, and other functions. The old version is Phpdoc, starting from 1.3.0, renamed Phpdocumentor, the new version adds support for PHP5 syntax, and can be converted to pdf,html,chm in several forms by manipulating the document on the client browser.
reference: Baidu Encyclopedia: http: // baike.baidu.com/view/1269751.htm Wikipedia: http: // En.wikipedia.org/wiki/phpdoc
Http://en.wikipedia.org/wiki/PhpDocumentor Official website: http: // Manual Documentation: http://manual.phpdoc.org/htmlsmartyconverter/hands/phpdocumentor/ Tutorial_phpDocumentor.pkg.html
Introduction to the native environment:
Wamp Integration Environment,PHP version 5.2.11
installation directory: D:\phpsetup\php5
Php.exe and php.ini. directory: D:\phpsetup\php5
1, confirm wamp environment can run normally.
2, start -to- run input cmd enter , switch to php.exe Location Directory
3. Input go-pear.bat
If there is a problem, modify go-pear.bat as follows:
@ECHO OFF Set php_bin=php. exe%php_bin%-D Phar. require_hash=0./pear/go-pear. Pause
The script here asks if we choose a server-wide or local copy, and we select the system. The default is to select the system, directly enter.
4. The Pear path configuration islisted here , asking if we can modify it. Enter to accept and start installing the Pear Library.
5, during installation, we are prompted to modify the php.ihi set inclue_path, enter " y" Span style= "font-family: the song Body;" > Enter to continue the installation.
Note: Here the setup script is set to automatically modify the php.ini settings include_path, as I observed, enter "Y" Enter,php.ini did not modify the success, here for insurance, we can confirm that the include_path is set correctly.
6, installation completed, prompted us to import the pear environment variable registry file: D:\phpsetup\php5\PEAR_ENV.reg , we found the file, Double-click Import Registry. Enter to end the installation. This file sets The role of the PEAR environment variable.
7, enter pear, confirm whether pear successfully installed, if the following interface appears, it means that pear has been installed successfully.
8, install phpdocumentor before some preparation, upgrade pear, may we install the Pear version will be a bit old, So here to upgrade pear.
Input:
Pear Upgrade Pear
When the upgrade is complete, install the phpdocumentor dependency package.
Input:
InstallInstall xml_beautifier
If the problem occurs:missing structures/graph.php file ...
Unzip the structures_graph-1.0. 4. tgz , Copy the structures directory into php\pear , Then the upgrade or installation will be no problem.
The installation package downloaded using CMD with pear is in the php\tmp directory.
Upgrade all packages: Pear upgrade-all
To view installed packages: Pear List
the Pear has been upgraded.
To install a package that already exists locally:
Install xml_parser-1.3. 4 Install tmp/phpdocumentor-1.4. 4. tgz
Removing tmp will re-download from the network and overwrite
9, installation phpdocumentor
Input:
Install Phpdocumentor
Install the local package: pear Install tmp/phpdocumentor-1.4. 3. tgz
Prompt for installation success
10, input phpdoc-h , get shown, it means the installation was successful.
11. Using Phpdoc
The simplest usage is
phpdoc-d [Source_path]-T [Target_path]
D stands for path directory, andT stands for target. Alternatively, you can select - f to specify a single file
Make a good path wait a moment, you can see the documentation in the target folder.
Example: Phpdoc-f D:\phpsetup\php5\docs\PhpDocumentor\Documentation\tests\bug-441275. Php-t new\
But this does not support Chinese, we use the following-o HTML:Smarty:PHP option:
Phpdoc-o html:smarty:php-f d:\phpsetup\php5\tmp\test.php-t New
This means that the HTML:Smarty:PHP template format is used, then the original code file is d:\phpsetup\php5\tmp\test.php, andthen the resulting file is placed in the current new directory the next.
If you only want to target a purpose, you can change the-F to- D and then follow the specified file name.
Template format basically has HTML, XML, PDF, CHM Four categories, usually I use HTML:Smarty:PHP This, because he is more beautiful !
And there's the CHM:default:default . used to generate CHM , but what he produced was . HHP archives, which have not yet passed HTML Helper compiled files, so install them separately HTML Helper to compile HHP files can produce the files you want.
-- Finally, how to write annotations --
Phpdocumentor annotations have certain specifications, but they are similar to the way we originally wrote annotations, just pay attention to things.
Let's take a simple example.
Example: test.php
<?PHP/** * Here is a description of this object * can be more than line Oh!~**/classMyClass {/** * Here is a description of the variable * @var int*/ var $a ; /** * Here is a description of the variable. * * @var string Here you can also put a description*/ var $b ; /** This is a description of the function * also can be multiple lines * If the simple example can also be placed here * @param int $a can be put into the incoming type * @return array can explain the type of the return*/ functionFirst ($a ) { return Array(); }}?>
Basically, it's all in
/* ** */
Write the notes in the middle, and don't forget to have a * in front of each line !
Annotations that are commonly used to parameters should be
@author Program author name, contact information @ Const constant @deprecate not recommended for use with api@ Global parameters of the global variable @param function @ return Callback Value @see reference function @since start time @ Static static variable @ var Object member variable @todo project to be carried out in the plan
If you feel this article has a harvest, remember to recommend Oh! ^_^
Installing Phpdocumentor (Phpdoc) notes under Windows