Home > Backend Development > PHP Tutorial > Composer automatically generates interface documents

Composer automatically generates interface documents

不言
Release: 2023-03-23 10:46:02
Original
1822 people have browsed it

The content introduced in this article is the interface document automatically generated by composer. Now I share it with everyone. Friends in need can refer to it

Installing composer(https://blog.csdn.net/sanbingyutuoniao123/article /details/70314651)
1. First download Composer-Setup.exe, download address: Download Composer. It will automatically search for the installation path of PHP.exe. If not, manually find php.exe in the php path.


#2. In the PHP directory, open the php.ini file and enable the openssl extension. Remove the semicolon (;) in front of extension=php_openssl.dll


3. Add the php directory to the environment variable (the path to the same level directory as php.exe). For example: D:\apache_php\php is added to the environment variable path.


4. Download composer.phar, download address: Composer.phar Put the composer.phar file into the php directory, and create a new file composer.cmd in the php directory. The content is written as:
@php "%~dp0composer.phar" %*Save. Run this file, then open cmd and run: composer will appear
You can run composer --version to view the composer version.


5. Execute in the command line: composer config -g repo.packagist composer https://packagist.phpcomposer.com


Rewriting the Packagist mirror to a domestic mirror can speed up downloading.


Finally, there is a Chinese manual for composer on Kancloud http://www.kancloud.cn/thinkphp/composer


Passed Composer installs software to automatically generate interface documents (https://packagist.org/packages/weiwei/api-doc)


cmd Enter the project directory and enter composer require weiwei/api-doc.


route.php:

use think/Route;

Route::pattern('id ','\d ');
Route::pattern('name','\w ');

Route::rule('createSign','ios/member/createSign'); //Generate token interface
Route::rule('iToken','ios/member/createToken');//Generate token interface
Route::rule('iSendSms','ios/sms/send' );//Send SMS verification code
Route::rule('imemsg','ios/member/memsg');//Get user information


address.php:
...
/**
* @title Home Category Products
* @description Home Category Products
* @author tiny
* @url /itypeGoods
* @method POST
*
* @param name:tid type:int require:1 default: other: desc:commodity type id
*
* @return type:type@
* @type id:type id cat_name:type name
*
* @return recommend:Recommend@
* @recommend id: product id image: product image goods_name: product name goods_price: price
* @return new: new product on the market @
* @new id: product id image: product image goods_name: product name goods_price: price
*
* @return image: picture@
* @image

*/

URL input: ip/doc

Related recommendations:

composer automatic loading instance analysis

The above is the detailed content of Composer automatically generates interface documents. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template