PHP connector entor Installation and Use)

Source: Internet
Author: User
Install and use phpbench entor by kuco | published:
2011/04/07

Phpdocumentor is a tool written in PHP. For PHP programs with standardized annotations, it can quickly generate API documents with functions such as mutual reference and indexing.

Installation environment:
The machine is installed with a EasyPHP-5.3.2i kit,

1 The installation directory is D: \ Program Files \ EasyPHP-5.3.2i \
2 Php.exe path is D: \ Program Files \ EasyPHP-5.3.2i \ php \ php.exe

First install pear:
1, modify D: \ Program Files \ EasyPHP-5.3.2i \ PHP \ go-pear.bat content is as follows:

1 @ECHO OFF
2 set PHP_BIN=%CD%\php.exe
3 "%PHP_BIN%" -d output_buffering=0 -d phar.require_hash=0 PEAR\go-pear.phar
4 pause

2, start-> Run-> cmd, run the go-pear.bat to start installing pear, one way press ENTER

1 Microsoft Windows XP [version 5.1.2600]
2 (C) Copyright 1985-2001 Microsoft Corp.
3  
4 C:\Documents and Settings\kuco>D:
5  
6 D:\>cd D:\Program Files\EasyPHP-5.3.2i\php
7  
8 D:\Program Files\EasyPHP-5.3.2i\php>go-pear.bat

3. Modify include_path in PHP. ini.

1 include_path = ".;${path}\php\includes;${path}\php\PEAR"

4. The php. ini file in easyphp is not stored in php.exe.

1 Copy D: \ Program Files \ EasyPHP-5.3.2i \ apache \ php. ini
2   To the D: \ Program Files \ EasyPHP-5.3.2i \ php \ directory

Start to install phpdocumentor:
5. Install the phpjavasentor dependency package xml_parser.

1 D:\Program Files\EasyPHP-5.3.2i\php>pear install XML_Parser
2 downloading XML_Parser-1.3.4.tgz ...
3 Starting to download XML_Parser-1.3.4.tgz (16,040 bytes)
4 ......done: 16,040 bytes
5 install ok: channel://pear.php.net/XML_Parser-1.3.4

6. Install phpdocumentor.

1 D:\Program Files\EasyPHP-5.3.2i\php>pear install PhpDocumentor
2 Did not download optional dependencies: pear/XML_Beautifier, use --alldeps to do
3 wnload automatically
4 pear/PhpDocumentor can optionally use package "pear/XML_Beautifier" (version >=
5 1.1)
6 downloading PhpDocumentor-1.4.3.tgz ...
7 Starting to download PhpDocumentor-1.4.3.tgz (2,423,486 bytes)
8 ......done: 2,423,486 bytes
9 install ok: channel://pear.php.net/PhpDocumentor-1.4.3

Generate comments using phpdocumentor
7. Suppose we want to generate a comment document for the smarty source code package.

1 Smarty source code storage directory: E: \ www \ IDE \ Smarty \ libs \
2 The directory where the annotation file is stored is: E: \ www \ IDE \ doc
3 Start to execute the command in the command line:
4 D:\Program Files\EasyPHP-5.3.2i\php>phpdoc.bat -o HTML:Smarty:PHP -d E:\www\IDE\Smarty\libs\ -t E:\www\IDE\doc

You can use the following command to get more help instructions:

1 D:\Program Files\EasyPHP-5.3.2i\php>phpdoc -h

In the phpdoc. Bat directory, enter

Phpdoc-H

A list of detailed parameters of phpdocumentor is displayed.

Let's select several common ones:

<〈? Command explanation? > 〉

-F
Name of the file to be analyzed. Multiple files are separated by commas.

-D
The directory to be analyzed. multiple directories are separated by commas.

-T
Path of the generated document

-O
Output document format. The structure is output format: converter name: Template directory, for example: HTML: frames: phpedit
 

This is what we will use. For other commands, please read the help prompt.

 

PHP starter entor trial

The following uses phpUnit2 in pear as an example to demonstrate how to use phpDocumentor to generate documents.

First, determine the required parameters:

<〈? Command parameters? > 〉

-D
C: Program FilesEasyPHP5phpPEARPHPUnit2

-T
C: Program FilesEasyPHP5phpphpunit2doc

-O
HTML: frames: phpedit
 

Based on the preceding parameters, we can combine the following commands:

Phpdoc-d "C: \ Program Files \ EasyPHP5 \ php \ PEAR \ PHPUnit2"-t "C: \ Program Files \ EasyPHP5 \ php \ phpunit2doc"-o "HTML: frames: phpedit"

After running the preceding command, the phpbench entor starts to parse the source file and output work information.

 

After the command is run, our document has been generated. Access the specified target directory and open index.html with a browser to view the generated document. The document interface consists of three parts: package information on the top left, navigation information on the bottom left, and detailed information presentation page on the right.

 

The above figure clearly describes the content of the document:

Index, function list, class list, file list, and sub-package.

Click the class (es) link above to clearly view the class tree of the entire package.

 

Click a class to go to the class description page.

The Class description page contains the following content:

 

L Description: copyright, author, category level, etc.

L Variables

L Constants

L Method

L inherited Variables

L inherited method: a very useful function

 

 

How about it? To generate a chm, you can change the-o parameter of the front edge to "CHM: default". In this way, the phpbench entor will generate a chm project file for you, you only need to use Microsoft's chm tool for compiling to obtain the available chm files.

 

Use phpDocumentor to generate documents for your own code

Although phpDocumentor can automatically analyze some information from the code, we still need to cooperate in coding to form a detailed document. In order to let phpDocumentor understand our code, we need to pay attention to some coding specifications and add some tags in the annotations:

 

<〈? Tags? > 〉

@ Author
Author Information

@ Const
Constant defined by define

@ Deprecate
APIS not recommended

@ Global
Global Variables

@ Package
Package information

@ Param
Function Parameters

@ Return
Return Value

@ See
Reference Functions

@ Since
Import time

@ Static
Static variables

@ Var
Class member variables
 

 

Here is a simple list of commonly used tags. You can read the phpDocumentor documentation, which contains detailed Encoding specifications. This article introduces phpDocumento. I hope you can use this tool to standardize your documents.

 

PS: phpDocumentor also has Web interface, you can access the http://phpdoc.org to get the Web version. The Web version is easy to install and can be run directly in a directory accessible to the web.

 

<〈? Environment requirements? > 〉

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.