在laravel 5.6 中使用swagger
composer require darkaonline/l5-swagger Using version ^5.6 for darkaonline/l5-swagger ... - Installing swagger-api/swagger-ui (v3.17.4) - Installing doctrine/annotations (v1.6.0) - Installing zircote/swagger-php (2.0.13) - Installing darkaonline/l5-swagger (5.6.5) ...
php artisan vendor:publish
<?php namespace ApphttpControllers; use IlluminateFoundationBusDispatchesJobs; use IlluminateRoutingController as BaseController; use IlluminateFoundationValidationValidatesRequests; use IlluminateFoundationAuthAccessAuthorizesRequests; /** * @SWGSwagger( * basePath="/calculate-rates", * @SWGInfo( * title="項目名稱 API", * version="1.0.0" * ) * ) */ class Controller extends BaseController { use AuthorizesRequests, DispatchesJobs, ValidatesRequests; }
php artisan l5-swagger:generate
/** * @SWGGet( * path="/home", * summary="用戶資料", * @SWGResponse(response=200, description="請求成功"), * @SWGResponse(response=401, description="用戶驗證失敗"), * @SWGResponse(response=500, description="服務器錯誤") * ) * */ public function index() { return view('home'); }
php artisan l5-swagger:generate
? 版權聲明
文章版權歸作者所有,未經允許請勿轉載。
THE END
喜歡就支持一下吧
相關推薦