PHP code example of laravel-toolbox / swagger-notes

1. Go to this page and download the library: Download laravel-toolbox/swagger-notes 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/ */

    

laravel-toolbox / swagger-notes example snippets


    composer 

   \Toolbox\Facades\SwaggerNotes::setRequest($request)
            ->setResponse($this->jsonRender(TransformHelper::camelSnakeCase($result, 'camel_case')))
            ->setComments(['affilliate_web', 'affilliate', 'member'], $request->rules($this->affiliateService), $this->optionComments)
            ->setApiInfo([
                'summary' => '查詢大聯盟會員資料',
                'description' => '含是否填寫個人資料、賬戶資料',
                'operation_id' => __FUNCTION__,
                'tags' => __CLASS__,
            ])
            ->generate();
   

   public $optionComments = [
        'metadata' => '元數據',
        'data' => '數據',
        'desc' => '狀態描述',
        'infoType' => '資料類型:ALL-全部;PROFILE-個人資料;ADDRINFO-通訊資料;ACCINFO-帳戶資料;WEBINFO-網站資料;',
        'profile' => '個人資料',
        'addrInfo' => '通訊資料',
        'accInfo' => '帳戶資料',
        'webInfo' => '網站資料',
        'brandName' => '白牌名稱',
        'brandSetting' => '白牌設置',
        'imageUrl' => '圖片連結',
        'brandUrl' => '白牌連結',
        'footerCopyright' => '底部授權信息',
        'citys' => '所含城市',
        'prods' => '所含省份',
        'profileFinished' => '個人資料是否完成的標識',
        'accInfoFinished' => '賬戶資料是否完成的標識',
        'isApproved' => '聯盟審核是否通過的標識',
        'isActive' => '聯盟賬戶是否活躍的標識',
    ];
   
shell
   swagger
   ├── Swagger                        # 生成的注釋目錄
   │     ├── Affiliate                # 生成的接口目錄
   │     │      └── affiliateView.php # 生成的接口注釋文件
   │     └── swagger.php              # 生成的注釋頭部信息文件
   ├── swagger-constants.php
   ├── swagger-info.php
   ├── swagger.yaml
   └── swagger_doc.yaml               # 生成的接口文件