All Projects → despark → apidoc

despark / apidoc

Licence: other
Laravel 5 api documentation generator

Programming Languages

PHP
23972 projects - #3 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to apidoc

awesome-www
Website of AwesomeWM
Stars: ✭ 39 (+225%)
Mutual labels:  apidoc
Bbs node
node后端服务,node+express+mysql, 搭建token-权限-管理完整的web服务, 对应页面: https://www.lyh.red/admin \ https://www.lyh.red/bbs \ 接口地址https://www.lyh.red/apidoc/index.html
Stars: ✭ 78 (+550%)
Mutual labels:  apidoc
Apigen
PHP 7.1 ready Smart and Simple Documentation for your PHP project
Stars: ✭ 2,068 (+17133.33%)
Mutual labels:  apidoc
Apidoc
RESTful API 文档生成工具,支持 Go、Java、Swift、JavaScript、Rust、PHP、Python、Typescript、Kotlin 和 Ruby 等大部分语言。
Stars: ✭ 785 (+6441.67%)
Mutual labels:  apidoc
Parse Comments
Parse JavaScript code comments. Works with block and line comments, and should work with CSS, LESS, SASS, or any language with the same comment formats.
Stars: ✭ 53 (+341.67%)
Mutual labels:  apidoc
Adoc
📄🖊轻松的的 API MD文档编写工具
Stars: ✭ 92 (+666.67%)
Mutual labels:  apidoc
springboot-chapter
🚀Spring Boot 2.0基础教程。主流框架整合,实践学习案例。
Stars: ✭ 23 (+91.67%)
Mutual labels:  apidoc
laralte2
LaraLTE2, Laravel PHP Framework with AdminLTE2
Stars: ✭ 25 (+108.33%)
Mutual labels:  apidoc
Gulp Apidoc
📄 RESTful web API Documentation Generator
Stars: ✭ 60 (+400%)
Mutual labels:  apidoc
Aiohttp Swagger
Swagger API Documentation builder for aiohttp server
Stars: ✭ 172 (+1333.33%)
Mutual labels:  apidoc
Ui
UI for https://www.apibuilder.io
Stars: ✭ 8 (-33.33%)
Mutual labels:  apidoc
Flask Apidoc
Adds ApiDoc support to Flask
Stars: ✭ 49 (+308.33%)
Mutual labels:  apidoc
Phprap
PHPRAP,是一个PHP轻量级开源API接口文档管理系统,致力于减少前后端沟通成本,提高团队协作开发效率,打造PHP版的RAP。如果您觉得PHPRAP对您有用的话,别忘了给点个赞哦^_^ !
Stars: ✭ 527 (+4291.67%)
Mutual labels:  apidoc
Irisadminapi
iris 框架的后台api项目
Stars: ✭ 544 (+4433.33%)
Mutual labels:  apidoc
Weather
Taiwan's Weather Maps! 想查詢每個地方的天氣嗎!?藉由 Google Maps API 的地圖服務,以及中央氣象局網站的天氣預報,讓你快速輕鬆的查詢台灣 368 個鄉鎮的天氣概況!
Stars: ✭ 206 (+1616.67%)
Mutual labels:  apidoc
iris-admin
Web admin for iris-go framwork
Stars: ✭ 602 (+4916.67%)
Mutual labels:  apidoc
Health Checks Api
Standardize the way services and applications expose their status in a distributed application
Stars: ✭ 78 (+550%)
Mutual labels:  apidoc
typeplate
REST API boilerplate with Typescript, Express.js, Typeorm and Mocha.
Stars: ✭ 268 (+2133.33%)
Mutual labels:  apidoc
apidoc-template
A cleaner and beautiful template for apiDoc
Stars: ✭ 46 (+283.33%)
Mutual labels:  apidoc
Goprowifihack
Unofficial GoPro WiFi API Documentation - HTTP GET requests for commands, status, livestreaming and media query.
Stars: ✭ 1,808 (+14966.67%)
Mutual labels:  apidoc

apidoc

Laravel 5 api documentation generator, based on Swagger

apidoc use just a few lines of code added to your controllers methods.

Installation

Require this package with composer using the following command:

composer require despark/apidoc

After that add to the providers array in config/app.php

Despark\Apidoc\ApiDocServiceProvider::class,

Then call

php artisan vendor:publish

Now you are ready to use the generator.

Usage

If you do all steps mentioned above than the file /yourapp/config/apidoc.php should be generated for you.

<?php
return [
    'apiVersion'     => '1.0.0',
    'apiTitle'       => 'My api',
    'apiDescription' => 'My api',
    'apiBasePath'    => '/api/v1',
    'authorization' => 'jwt'
];

All those parameters are displayed on swagger api doc page so you can change them to fit your settings.

Authorization

By default swagger is configured to use JWT authentication via Authorization Header: Bearer. If you want standard auth trough query just change the authorization option to null.

For now these are the only authorization options available.

Controllers and methods

Every single method that has been documented in apidoc documentation way and present in laravel's routs.php will be parsed and shown in the api documentation. Method documentation example:

    /**
     * @apiDesc A description of the method
     * @apiParam string $parameterName required in_path | Description of the parameterName  
     * @apiParam array $parameterName2 | Description2 of the parameterName
     *
     * @apiErr 422 | Validation errors
     * @apiErr 403 | Unauthorized access
     * @apiResp 200 | Whatever message is send from backend on sucess
     */
    public function index($id, DesignRequest $request){}

Notice: Every single "@api" element and description should be on a single row.

  • @apiDesc - A description of the method

  • @apiParam - There is no limit of parameters. Parameters can be required or not required. If word required is typed the parameter is marked as required. Check the example above.

    Params types:

    • string
    • file - uploadable file
    • array
    • bool or boolean (both are available and equal)
    • integer
    • password
    • double
  • @apiErr XXX - can have more than one error messages that are returned in response. XXX is the http status code.

  • @apiResp XXX - the response data of the api call. XXX is the http status code.

  • url parameters (such id in the example), are taken automatically and declared as integer

You can set how the parameters are send and there are 3 options:

  • formData - this is the default option and it is not needed to be mention in the comments
  • in_path - where the parameter value is actually part of the operation's URL. For example, in /items/{itemId}, the path parameter is itemId.
  • in_query - Parameters that are appended to the URL. For example, in /items?id=123, the query parameter is id.
  • more information at Swagger specification page

NOTICE: Everything after "|" symbol is assumed as a description text. So use just one "|" symbol on a row.

Command

After everything is setup, the controllers are declared in route.php file and there are comments in the controllers we can call the command.

php artisan apidoc:generate

That's it. Now you can access your new documentation at APP_URL/docs#/

Notice APP_URL is used for swagger integration. If it is not set in your .env file, the command will return a message, asking you to set up APP_URL.
Notice APP_URL example: http://example.info/

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].