PHP learning-use PhpDocumentor2 to generate API documentation. Official Website address: www.phpdoc.org Project address: github. comphpDocumentorphpDocumentor2phpDocumentor2 is an official website address of Cheng, which can analyze php source code and comment blocks and generate documents.
PhpDocumentor 2 is a program that can analyze php source code and comment blocks and generate documents.
Inspired by phpjavasentor 1 and javadoc, it continues to use innovative new technologies and new features supporting php.
Phpbench entor 2 features:
- Compatible with php5.3 and fully supports namespaces and closures.
- Recognition supports any tag and some append (such as @ link ).
- Faster processing speed. It significantly reduces the processing time of phpworker entor 1 under Zend Framework.
- Low memory consumption. the memory consumption for small and medium-sized projects is less than 20 MB, 40 MB, and 100 MB, respectively.
- Incremental resolution. If you have the structure. xml file obtained by running phpdoc, the speed of re-generating the document after a small modification will be increased by 80%.
- You can simply create a template, with only one small step and three files being edited.
- Compatible with 1-generation command lines. For example, -- directory, -- file and -- target
- Two-step processing. First, generate the structure file. you can format the relevant information based on this file and use your own tools to display the information!
Installation Requirements:
- PHP 5.3.3 or higher
- Ext/iconv, http://php.net/manual/en/book.iconv.php (enabled by default since PHP 5.0.0)
- Ext/intl, http://php.net/manual/en/book.intl.php
- The XSL extension, http://www.php.net/manual/en/book.xsl.php (optional, used only when using The xsl template)
- Graphviz (optional) used to generate class diagrams)
Install phpDocumentor 2
1. install on pear:
Download pear http://pear.php.net/go-pear.phar
Put the go-pear.phar under the PHP Directory
Run the following command:
php go-pear.phar
Enter system
Then press enter to complete installation.
2. install the tools used for class link plotting:
pear install image_graphviz
Download http://www.graphviz.org/Download_windows.phpGraphviz-2.38.msi
After installation, check whether the bin path has been added to the environment variable path,
The following is an important step: restart your computer; otherwise, it will not take effect.
3. install phpDocumentor
Pear channel-discover pear.phpdoc.org // register channelpear remote-list-c phpdoc // list the available versions of pear install phpdoc/phpjavasentor // install phpjavasentor
For details, refer to: http://pear.phpdoc.org/
Installation steps are complete!
Tip:
The directories after the two software are installed are under pear in PHP:
- Php/pear/php#entor
- Php/pear/Image
Use phpjavasentor 2
The following documents are generated:
Under the PHP root directory:
Phpdoc-d project absolute path-t generated file storage path
D indicates the path directory, and t indicates the target. Alternatively, you can select-f to specify a single file. After creating a path, wait a moment and you will be able to see the instructions in the target folder.
Example:
phpdoc -d E:\bak\video\code -t E:\bak\video\code\doc
E: \ bak \ video \ code is the php code folder
E: \ bak \ video \ code \ doc is the folder for generating documents
The specific parameters are as follows:
Project: run [-t | -- target [= "... "] [-f | -- filename [= "... "] [-d | -- directory [= "... "] [-e | -- extensions [= "... "] [-I | -- ignore [= "... "] [-- ignore-tags [= "... "] [-- hidden] [-- ignore-symlinks] [-m | -- markers [= "... "] [-- title [= "... "] [-- force] [-- validate] [-- visibility [= "... "] [-- defaultpackagename [= "... "] [-- sourcecode] [-p | -- progressbar] [-- template [= "... "] [-- parseprivate] [-c | -- config [= "... "]
Phpbench entor 2 is a process that can analyze php source code and comment blocks and generate documents...