th3mouk / openapi-generator
PHP library which provide a scaffolding and generate an OpenAPI file
Requires
- php: >=7.4
- ext-json: *
- symfony/console: ^4.1|^5.0
- symfony/finder: ^4.1|^5.0
- symfony/yaml: ^4.1|^5.0
Requires (Dev)
- phpstan/phpstan: ^0.12.33
- youdot/coding-standard: ^3.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
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.
Installation
composer require th3mouk/openapi-generator
Usage
Inside your project you can now run additional commands:
vendor/bin/openapi scaffoldvendor/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.