PHP code example of dcat-plus / apidocs
1. Go to this page and download the library: Download dcat-plus/apidocs 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/ */
dcat-plus / apidocs example snippets
'ui' => [
'search' => false,
],
'ui' => [
'title' => 'API Docs',
'theme' => 'light', // light、dark、system
'hide_try_it' => false,
'hide_schemas' => false,
'logo' => '',
'try_it_credentials_policy' => '
'ui' => [
'export_json' => false,
],
'servers' => [
'Local' => 'api',
'Test' => 'https://test.example.com/api',
'Prod' => 'https://api.example.com/api',
],
'servers' => [
[
'url' => 'https://api.example.com/api',
'description' => 'Prod',
],
],
'ui' => [
'server_switcher' => false,
],
use DcatPlus\Apidocs\Attributes\Group;
#[Group('Clife运动', 'Clife运动记录与统计接口', 15)]
class SportController extends BaseClifeController
{
// ...
}
use DcatPlus\Apidocs\Attributes\Group;
/**
* 内部同步接口
*
* @internal
*/
#[Group('内部', '内部维护接口', 999)]
public function sync()
{
// ...
}
'scan' => [
'
use DcatPlus\Apidocs\Attributes\Group;
/**
* 查询学生体测统计
* 返回区域体测汇总数据。
*
* @authenticated
* @queryParam page int optional 页码 example:1
* @queryParam page_size int optional 每页条数 example:20
* @urlParam region_id int bash
php artisan vendor:publish --tag=apidocs-config
bash
php artisan apidocs:generate