定制 exsyst/swagger 二次开发

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

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

exsyst/swagger

最新稳定版本:v0.4.2

Composer 安装命令:

composer require exsyst/swagger

包简介

A php library to manipulate Swagger specifications

README 文档

README

Build Status Scrutinizer Code Quality Code Coverage

A php library to manipulate Swagger/Open API specifications.

Installation

composer require EXSyst/Swagger

Usage

Read an api.json file:

$swagger = Swagger::fromFile('api.json');

// or

$swagger = new Swagger($array);

Collections

There are two major collections: Paths and Definitions. The API is similar for both:

$paths = $swagger->getPaths();
$p = new Path('/user');

foreach ($paths as $path) {
	// adding
	$paths->add($a);
	
	// retrieving
	if ($paths->has('/user') || $paths->contains($p)) {
		$path = $paths->get('/user');
	}
	
	// removing
	$paths->remove('/user');
}

Models

There are a lot of models, e.g. the mentioned Path above. The API is well written, so it works with the auto-completion of your IDE. It is straight forward and uses the same naming scheme as the OpenAPI specification.

Contributing

Feel free to fork and submit a pull request (don't forget the tests) and I am happy to merge.

统计信息

  • 总下载量: 15.97M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 360
  • 点击次数: 1
  • 依赖项目数: 8
  • 推荐数: 0

GitHub 信息

  • Stars: 359
  • Watchers: 2
  • Forks: 18
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04