th3mouk/openapi-generator

PHP library which provide a scaffolding and generate an OpenAPI file

0.3.0 2020-07-23 09:48 UTC

This package is auto-updated.

Last update: 2024-10-23 19:22:26 UTC


README

This PHP library allows you to cut and organize your HUGE openapi.yml file, into small slices.

Versioning and deploy your OpenAPI documentation become easier.

Latest Stable Version Latest Unstable Version Total Downloads License

Build Status Scrutinizer Code Quality

Installation

composer require th3mouk/openapi-generator

Usage

Inside your project you can now run additional commands:

  • vendor/bin/openapi scaffold
  • vendor/bin/openapi generate

Scaffold

To prepare your project, run the first command scaffold.

It will create new folders.

specs
├── components
│   ├── schemas
│   ├── responses
│   ├── parameters
│   ├── examples
│   ├── requestBodies
│   ├── headers
│   ├── securitySchemes
│   ├── links
│   └── callbacks
└── paths

Add your schema

I personnaly use Swagger OpenAPI specifications to write my schema.

One example of organization can be :

specs
├── components
└── paths
    ├── authentication
    │   ├── login.yaml
    │   └── register.yaml
    └── unicorn
        ├── list.yaml
        └── detail.yaml

Generate

The command vendor/bin/openapi generate take arguments and options to generate the openapi.yml file.

You can add a path like this vendor/bin/openapi generate /in-this-folder/sub

And it exists a --pretty-json or -p option to obtain a human readable file.

Please

Feel free to improve this library.