OpenAPI Initializer

Packages

January 19th, 2021

OpenAPI Initializer is a Laravel package that provides a straightforward command to scaffold an OpenAPI spec file.

Once you install the package, you can run the artisan command to walk you through various questions to make the OpenAPI specification.

You start by running the command:

php artisan openapi:create

Then the plugin will walk you through a bunch of questions to construct the specification file:

Once you walk through the questions, OpenAPI Initializer will generate an openapi.yml specification file that will look similar to the following:

openapi: 3.0.3
info:
    title: ''
    version: 0.1.0
    description: 'Test API'
    contact: { name: 'Laravel News', email: user@example.com, url: null }
servers:
    - { url: 'http://openapi-demo.test', description: 'Local url for testing' }
tags: null
paths: null
components:
    schemas: null
    responses: null
    headers: null
    parameters: null
    links: null
    examples: null

You can learn more about this package, get full installation instructions, and view the source code on GitHub. If you’d like the know more about OpenAPI, I suggest an OpenAPI 3.0 Tutorial and the OpenAPI Specification (3.0.3) document.

Filed in:

Paul Redmond

Full stack web developer. Author of Lumen Programming Guide and Docker for PHP Developers.