OpenAPI Initializer

Packages

January 19th, 2021

open-api-initializer-featured.png

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:

1php 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:

1openapi: 3.0.3
2info:
3 title: ''
4 version: 0.1.0
5 description: 'Test API'
6 contact: { name: 'Laravel News', email: user@example.com, url: null }
7servers:
8 - { url: 'http://openapi-demo.test', description: 'Local url for testing' }
9tags: null
10paths: null
11components:
12 schemas: null
13 responses: null
14 headers: null
15 parameters: null
16 links: null
17 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.