定制 paplauskas/apidocs 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

paplauskas/apidocs

Composer 安装命令:

composer require paplauskas/apidocs

包简介

A simple plug-and-play Laravel 5 package that will automatically generate API documentation from your routes file.

README 文档

README

What is this repository for?

A simple plug-and-play Laravel 5 package that will generate a nice API documentation page based on your documented routes.

List view

Setup

Do NOT install this package on your production environment unless you intend to make your API documentation public. In most cases it's best to keep it in the development environment.

Run this in your project folder:

composer require paplauskas/apidocs --dev

Add this to the config/app.php providers:

Paplauskas\ApiDocs\ApiDocsServiceProvider::class,

That's it!

How do I use it?

If setting up ApiDocs went well, you should be able to access it through /apidocs route (for example http://website.dev/apidocs).

Please note that you still have to document your endpoints by hand - ain't no magic here.

How to write documentation?

Just write comments right next to your routes. Api endpoint description format is pretty similar to the usual DocBlocks format. Write comments right before the route you wish to document. Example:

    /**
    * @title Upload an image
    * @description Uploads the original image to the server, resizes it.
    * @group Images
    * @param  image
    * @param  scale
    * @return stored image url
    */
    Route::post('images/upload', 'ImageController@upload');

    /**
    * Get image
    * Returns image info
    * @group Images
    * @param  imageID
    * @return path
    * @return alt
    * @return width
    * @return height
    */
    Route::get('images/{imageID}', 'ImageController@show');

As you probably noticed, @ title and @ description are optional tags - the first line is always treated as a title. @param, @return can be declared in several lines if you want to. Description line is optional and doesn't have to be specified at all. Use whatever format is more readable to you.

Package is smart enough to recognise group prefixes, so don't worry about them.

Undocumented routes are ignored.

ApiDocs checks for routes in the usual locations:

  • app/Http/routes.php
  • routes/api.php
  • routes/web.php

Found a bug?

File an issue in issue tracker.

统计信息

  • 总下载量: 1k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-03-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固