/openapi-class-generator

Generate PHP classes from given OpenAPI v3.x contracts.

Primary LanguagePHPMIT LicenseMIT

OpenAPI Class Generator

Build Status Mutation testing badge

The aim of this library is to turn an OpenAPI v.3.x contract into PHP classes ready to use for communicate with the service behind the contract.

Installation

composer require jdomenechb/openapi-class-generator

Usage

vendor/bin/ocg generate <inputPathFolder> <outputPathFolder>

WARNING: The contents of the output folder will be deleted entirely at each generation.

The namespace for the generated files can be defined by using --namespace:

vendor/bin/ocg generate contracts src-generated --namespace An\\Org\\Namespace