PHPDocumentor2.8.5 installation, use and quick start

Source: Internet
Author: User
Tags pear unpack checkstyle

Phpdocumentor Current version is phpdocumentor-2.8.5.tgz

What is the use of phpdocumentor, and its history, I do not introduce, directly into the topic.
The old version of called Phpdoc, starting from 1.0, 2017/2 months of the latest version is: 1.4.4 (Phpdoc has stopped releasing the direct new version of the go, the new version supports better)
The new version is called Phpdocumentor, starting with 2.0 versions, 2017/2 months of the latest versions are: 2.8.5
2.0 Official Website: https://phpdoc.org

One installation Phpdocumentor
There are three ways to install Phpdocumentor:
A. Using Pear
Join the Phpdoc Channel
$ pear Channel-discover pear.phpdoc.org

Installing Phpdoc
$ pear Install Phpdoc/phpdocumentor

This method is limited to pear,windows under normal download, but will not be able to decompress the installation package.
Error: Error:unable to unpack c:/*****

B. Executing Phpdoc interface document generation directly using the Phpdocumentor.phar file
Download Phpdocumentor.phar
Http://www.phpdoc.org/phpDocumentor.phar.

After downloading, go to the directory where the Phpdocumentor.phar file is located, execute the Interface document Generation command directly,
That is, you can use PHP Phpdocumentor.phar followed by the second part of the parameters, (personal understanding is free installation)
Use Phpdocumentor to generate interface documentation directly.
PHP phpdocumentor.phar-d. -T Docs/api

C. Using composer
Composer official website https://getcomposer.org

Installing composer
Php-r "Copy (' Https://getcomposer.org/installer ', ' composer-setup.php ');"
Php-r "if (Hash_file (' SHA384 ', ' composer-setup.php ') = = =" 55d6ead61b29c7bdee5cccfb50076874187bd9f21f65d8991d46ec5cc90518f447387fb9f76ebae1fbbacf329e583e30 ') {echo ' Installer verified '; } else {echo ' Installer corrupt '; unlink (' composer-setup.php ');} echo php_eol; "
PHP composer-setup.php
Php-r "unlink (' composer-setup.php ');"

Specify Configuration Item Installation
Specify the installation path
PHP composer-setup.php--install-dir=bin

Specify file name
PHP composer-setup.php--filename=composer

Specify version
PHP composer-setup.php--version=1.0.0-alpha8

Installing Phpdoc
$ composer require "phpdocumentor/phpdocumentor:2.*"

Summary:
Try all three ways:
The B method is not the most reliable installation, but when used to enter the Phpdocumentor.phar file directory (or simply put this file in the environment variable directory), and then the following Phpdoc command to replace PHP Phpdocumentor.phar;
A method can be downloaded, but Windows will report error:unable to unpack c:/***** installation error;
C method Inexplicably, obviously installed successfully, but when using the Phpdoc command, tell me that the command does not exist ... Is the problem of environment variables under Windows? studied again later.

Two settings, query, generate template
A. Viewing a list of templates
To find out which templates are currently available
$ Phpdoc Template:list

B. Generating a document by a specified template
$ phpdoc-d "./src"-T "./docs/api"--template= "Checkstyle"
Create documents for different templates at once
$ phpdoc-d "./src"-T "./docs/api"--template= "Checkstyle,clean"
Create a file for a custom template
$ phpdoc-d "./src"-T "./docs/api"--template= "Data/templates/my_template"

C. Start generating Interface documentation
A total of three kinds of writing, the role is the same, as follows:
$ phpdoc-d|-f <PATH>-T <PATH> [parameters]
$ phpdoc run-d|-f <PATH> t <PATH> [parameters]
$ phpdoc project:run-d|-f <PATH> t <PATH> [parameters]

-D followed by the interface directory that needs to be compiled
-F followed by the interface file that needs to be compiled
-D and-F two Select one
-T refers to where the interface document is generated
[Parameters] is the additional parameter added later
–encoding Encoding method
–title[= the title of the document "..."
–force Ignore exception Continue execution
--template= "" Select the template you want to compile

There are many less common, please see the official documentation for details:
Https://phpdoc.org/docs/latest/references/commands/project_run.html#usage

Example:
Phpdoc (or PHP Phpdocumentor.phar)-D "E:\PHPDoc\Controller"-T "E:\PHPDoc"--template= "Responsive-twig"

Note: Be sure to use double quotation marks * * *

Summary:
The resulting document file is opened directly in the browser;
Or
Copy the new makefile from the target directory (E:\PHPDoc after-T in the previous example) to the server directory and open the Access server.

Three notes fill in the specification

Tag nametag description using range tag
@apimethods declaration elements are appropriate for third-party consumption.
@ahthorany the author of the relevant element of the document.
@categoryfile, class combines a series of packages.
@copyrightany record the copyright information for the relevant element.
@deprecatedany indicates that the relevant element is not to be removed in a future release.
@exampleany Displays the code for the specified sample file, or optionally, just a subset of it.
@filesourcefile contains the source for the current file for output.
@globalvariable notifies a global variable or uses phpdocumentor.
@ignoreany tell Phpdocumentor that the associated element is not included in the document.
@internalany indicates that the associated element is internal to this application or library and is hidden by default.
@licenseany indicates which license the associated element applies to.
@linkany represents the relationship between the associated element and the site page.
@methodclass allows a class to know this "magical" method call.
@packagefile, class is a logical grouping or subdivision of related elements.
@parammethod, Fucntion records a single parameter of a function or method.
@propertyclass allow classes to know which "magic" attributes exist.
@property-readclass allows classes to know which "magic" attributes are read-only.
@property-writerclass allows classes to know which "magic" attributes are currently only written.
@returnmethod, the function records the return value of the functions or methods.
@seeany indicates a reference from an associated element to a Web site or other element.
@sinceany indicates which version of the associated element is available.
@sourceany, except file displays the source code of the associated element.
@subpackagefile, class is a logical grouping or subdivision of related elements.
@throwsmethod, the function indicates whether the associated element throws a specific type of exception.
@todoany indicates whether any development activities should be performed on the associated element.
@usesany represents a single associative element that references (and is from).
@varproperties
@versionany represents the current version of the structure element.

Summary:
The most common is @return, put the comments you want to display below this tag,
Then all unmarked annotations below the @return will be displayed.

PHPDocumentor2.8.5 installation, use and quick start

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.