| Install | |
|---|---|
composer require io-digital/opendox |
|
| License: | MIT |
| Last Updated: | Dec 6, 2022 |
| Links: | GitHub · Packagist |
This package will add console command to lumen/laravel which will parse yml file, convert it into json and save to public path. Redoc UI is connected and Swagger UI are connected and can be accessed to view generated documentation. Also package adds route for raw json documentation output, so this package can be used in microservice architecture, where all your microservices expose list of available routes.
php artisan opendox:transform to transform OpenApi 3.0 specification yaml files to json, so it can be accessible for external services/api/documentation route where you can access Redoc UI interface of documentation/api/console route where you can access Swagger UI interface for API docs and interaction/docs route where RAW json can be accessed$ composer require io-digital/opendox
$ php artisan vendor:publish --provider="IoDigital\Opendox\ServiceProvider"
$app->register(IoDigital\Opendox\ServiceProvider::class);
$app->configure('opendox');
/src folder create api-docs.yml file. Write your documentation using OpenAPI standardopenapi: "3.0.0"
info:
version: 1.0.0
title: Swagger Petstore
license:
name: MIT
servers:
- url: http://petstore.swagger.io/v1
paths:
/pets:
get:
summary: List all pets
operationId: listPets
tags:
- pets
parameters:
- name: limit
in: query
description: How many items to return at one time (max 100)
required: false
schema:
type: integer
format: int32
responses:
'200':
description: A paged array of pets
headers:
x-next:
description: A link to the next page of responses
schema:
type: string
content:
application/json:
schema:
$ref: "#/components/schemas/Pets"
default:
description: unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
components:
schemas:
Pet:
required:
- id
- name
properties:
id:
type: integer
format: int64
name:
type: string
tag:
type: string
Pets:
type: array
items:
$ref: "#/components/schemas/Pet"
Error:
required:
- code
- message
properties:
code:
type: integer
format: int32
message:
type: string
$ php artisan opendox:transform
/api/documentation - Redoc UI interface
/api/console - Swagger UI with ability to send example requests
/docs - Raw JSON documentation output, that can be used for external services