1. Go to this page and download the library: Download zhangzhuow/document library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
zhangzhuow / document example snippets
namespace Document\Command;
/**
* @ApiTitle (name) 此参数为必须
*/
class User
{
/**
* @ApiTitle (name) 此参数为必须
* @ApiDescription(section="User", description="Get information about user")
* @ApiMethod(type="get")
* @ApiRoute(name="/user/get/{id}")
* @ApiParams(name="id", type="number", value="value" nullable=false, description="User id")
* @ApiParams(name="data", type="object", sample="{'user_id':'int','user_name':'string','profile':{'email':'string','age':'integer'}}")
* @ApiReturnHeaders(sample="HTTP 200 OK")
* @ApiReturn(type="object", sample="{
* 'transaction_id':'int',
* 'transaction_status':'string'
* }")
*/
public function get()
{
}
/**
* @ApiTitle (name) 此参数为必须
* @ApiDescription(section="User", description="Create's a new user")
* @ApiMethod(type="post")
* @ApiRoute(name="/user/create")
* @ApiParams(name="username", type="string", nullable=false, description="Username")
* @ApiParams(name="email", type="string", nullable=false, description="Email")
* @ApiParams(name="password", type="string", nullable=false, description="Password")
* @ApiParams(name="age", type="number", nullable=true, description="Age")
*/
public function create()
{
}
}
return [
'app\home\command\Test',
];
$ php think -l
Think Console version 0.1
Usage:
command [options] [arguments]
Options:
-h, --help Display this help message
-V, --version Display this console version
-q, --quiet Do not output any message
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Available commands:
api Build Api document from controller
build Build Application Dirs
clear Clear runtime file
help Displays help for a command
list Lists commands
make
make:controller Create a new resource controller class
make:model Create a new model class
$ php think api
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.