Skip to content

jericizon/jheckdoc-laravel

Repository files navigation

JheckDoc Laravel logo

Jheckdoc laravel

MIT License GitHub last commit

Simple laravel api document generator



Dashboard preview

Demo page:

https://jheckdoc-laravel-demo.herokuapp.com/api/documentation

Installation

You can install the package via composer

composer require jheckdoc/jheckdoc-laravel

Usage

Generate json file

php artisan jheckdoc:generate

Publish config files

$ php artisan vendor:publish --tag=jheckdoc-config

Parameters

Name Type Description
@jheckdocInfo String TThis is required for details of api documentation. Sample header
@jheckdoc String This is required to add on top of each codeblocks. Sample annotation
method String Your desired route method, Sample GET, POST, PUT, DELETE, OPTIONS
route String Your api endpoint. Note: no need to put the full url
name String Enter desired name for your endpoint
description String Description of your endpoint
headers Object For custom headers
params Object Enter parameters for your endpoint
responses Object Server responses

Api documentation detail information (required)

/*@jheckdocInfo
{
    "version": "1.0.0",
    "title":"Jheckdoc API",
    "description" : "Sample description of api",
    "contact" : "hello@jheckdoc.com",
    "servers": [
        {
            "url" : "https://jheckdoc.com",
            "description": "Production api server"
        },
        {
            "url" : "https://dev.jheckdoc.com",
            "description": "Development api server"
        }
    ]
}
*/

Sample annotation

Each code block requires a valid json format. Please see Sample annotations for more.

/*@jheckdoc
    {
        "method" : "POST",
        "route" : "/v1/users/login",
        "name":"User login",
        "description": "Login to get authorization token.",
        "group":"user",
        "headers":{
            "Content-Type": {
                "required": true,
                "value":"application/x-www-form-urlencoded"
            }
        },
        "params" : {
            "email" :{
                "type":"string",
                "description": "Enter E-mail address",
                "required" : true
            },
            "password" :{
                "type":"string",
                "description": "Enter Password",
                "required" : true
            }
        },
        "responses": {
            "200": {
                "description": "Success"
            },
            "401": {
                "description": "Unauthenticated"
            }
        }
    }
*/

View api docs (default)

http://localhost:8000/api/documentation

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, pelase use issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Copyright (c) 2020, Jeric

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.