定制 allansun/openapi-parser 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

allansun/openapi-parser

Composer 安装命令:

composer require allansun/openapi-parser

包简介

A universal OpenAPI (Swagger) schema parser

README 文档

README

Latest Stable Version Total Downloads License codecov

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

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

<?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.

Alternatively, you can call the correct parser directly.

<?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

<?php

    use OpenAPI\Parser\SwaggerParser;
    
    $Parser = new SwaggerParser();
    
    $Swagger = $Parser->parse(json_decode(file_get_contents('swagger.json'), true));

The result would be:

OpenAPI

Contributing

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

Versioning

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

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

统计信息

  • 总下载量: 12.96k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 12
  • 点击次数: 7
  • 依赖项目数: 92
  • 推荐数: 0

GitHub 信息

  • Stars: 11
  • Watchers: 1
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-06-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固