2017 © Pedro Peláez
 

library openapi-parser

A universal OpenAPI (Swagger) schema parser

image

allansun/openapi-parser

A universal OpenAPI (Swagger) schema parser

  • Sunday, July 15, 2018
  • by allansun
  • Repository
  • 1 Watchers
  • 0 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

PHP OpenAPI (Swagger) parser

Latest Stable Version Total Downloads License codecov, (*1)

A universal OpenAPI (V3) and Swagger (V2) schema parser that converts OpenAPI/Swagger files into PHP objects for programming use., (*2)

Installing

composer require-dev allansun/openapi-parser

Usage

This project is intended for development environments only. It does not generate or provide any code for runtime environments. To start, (*3)

<?php

    use OpenAPI\Parser;

    $OpenAPI = Parser::parse('openapi.json');

The parser class will automatically detect input file type (JSON or YAML) and use correct parser (Swagger or OpenAPI) to parse the input., (*4)

Alternatively, you can call the correct parser directly., (*5)

<?php

    use OpenAPI\Parser\OpenAPIParser;

    $Parser = new OpenAPIParser();

    $OpenAPI = $Parser->parse(json_decode(file_get_contents('openapi.json'), true));

Or to parse the legacy Swagger version, (*6)

<?php

    use OpenAPI\Parser\SwaggerParser;

    $Parser = new SwaggerParser();

    $Swagger = $Parser->parse(json_decode(file_get_contents('swagger.json'), true));

The result would be:, (*7)

OpenAPI, (*8)

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us., (*9)

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository., (*10)

Authors

See also the list of contributors who participated in this project., (*11)

License

This project is licensed under the MIT License - see the LICENSE.md file for details, (*12)

The Versions

15/07 2018

dev-master

9999999-dev

A universal OpenAPI (Swagger) schema parser

  Sources   Download

proprietary

The Requires

 

The Development Requires