swaggest/swagger2-schema
最新稳定版本:v0.2.6
Composer 安装命令:
composer require swaggest/swagger2-schema
包简介
Swagger 2.0 schema PHP mappings
README 文档
README
Access and validate OpenAPI 3.0 and Swagger 2.0 schemas from PHP.
Installation
composer require swaggest/swagger2-schema
Usage
OpenAPI 3.0
// Load schema $json = json_decode(file_get_contents(__DIR__ . '/../../../spec/petstore-openapi3.json')); // Import and validate $schema = OpenAPI3Schema::import($json); // Access data through PHP classes $this->assertSame('Swagger Petstore', $schema->info->title); $ops = $schema->paths['/pets']->getGetPutPostDeleteOptionsHeadPatchTraceValues(); $this->assertSame('List all pets', $ops['get']->summary); $responseSchema = $ops['get']->responses[200]->content['application/json']->schema; $this->assertSame('array', $responseSchema->type);
Swagger 2.0
// Load schema $json = json_decode(file_get_contents(__DIR__ . '/../../spec/petstore-swagger.json')); // Import and validate $schema = SwaggerSchema::import($json); // Access data through PHP classes $this->assertSame('Swagger Petstore', $schema->info->title);
统计信息
- 总下载量: 8.04k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-01-02