2017 © Pedro Peláez
 

library swagger

A php library to manipulate swagger specifications

image

gossi/swagger

A php library to manipulate swagger specifications

  • Wednesday, November 16, 2016
  • by gossi
  • Repository
  • 1 Watchers
  • 16 Stars
  • 27,623 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 16 Forks
  • 0 Open issues
  • 6 Versions
  • 14 % Grown

The README.md

swagger

License Latest Stable Version Total Downloads
HHVM Status Build Status Scrutinizer Code Quality Code Coverage, (*1)

A php library to manipulate swagger/Open API specifications., (*2)

Installation

composer require gossi/swagger

Usage

Read an api.json file:, (*3)

$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:, (*4)

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

// adding
$paths->add($p);

// retrieving
if ($paths->has('/user') || $paths->contains($p)) {
    $path = $paths->get('/user');
}

// removing
$paths->remove('/user');

// iterating
foreach ($paths as $path) {
    // do sth with $path
}

Other collections are: Headers, Parameters, Responses and SecurityDefinitions., (*5)

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., (*6)

Contributing

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

The Versions

16/11 2016

dev-master

9999999-dev

A php library to manipulate swagger specifications

  Sources   Download

MIT

The Requires

 

The Development Requires

api swagger

16/11 2016

v0.3

0.3.0.0

A php library to manipulate swagger specifications

  Sources   Download

MIT

The Requires

 

The Development Requires

api swagger

17/06 2016

v0.2.2

0.2.2.0

A php library to manipulate swagger specifications

  Sources   Download

MIT

The Requires

 

The Development Requires

api swagger

14/05 2016

v0.2.1

0.2.1.0

A php library to manipulate swagger specifications

  Sources   Download

MIT

The Requires

 

The Development Requires

api swagger

27/04 2016

v0.2

0.2.0.0

A php library to manipulate swagger specifications

  Sources   Download

MIT

The Requires

 

The Development Requires

api swagger

11/12 2015

v0.1

0.1.0.0

A php library to manipulate swagger specifications

  Sources   Download

MIT

The Requires

 

The Development Requires

api swagger