PHPackages                             gossi/swagger - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. gossi/swagger

ActiveLibrary[API Development](/categories/api)

gossi/swagger
=============

A php library to manipulate swagger specifications

v0.3(9y ago)1879.2k↑16.7%183MITPHPPHP &gt;=5.4

Since Dec 11Pushed 4y ago1 watchersCompare

[ Source](https://github.com/phpowermove/swagger)[ Packagist](https://packagist.org/packages/gossi/swagger)[ RSS](/packages/gossi-swagger/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (4)Versions (7)Used By (3)

swagger
=======

[](#swagger)

[![License](https://camo.githubusercontent.com/f6f6c237e56d624a172330f0144770d7b1444f2246965051cdad3ffb2bd78ec0/68747470733a2f2f706f7365722e707567782e6f72672f676f7373692f737761676765722f6c6963656e7365)](https://packagist.org/packages/gossi/swagger)[![Latest Stable Version](https://camo.githubusercontent.com/bd6918d1cbb0cf9686b91ff4ce346c4f0f148282e702b8e1bc4f72932554a4a1/68747470733a2f2f706f7365722e707567782e6f72672f676f7373692f737761676765722f762f737461626c65)](https://packagist.org/packages/gossi/swagger)[![Total Downloads](https://camo.githubusercontent.com/7cdc005dd996bf4cc863f68a629bc0c53eff42fc55a39ad2fd87548abe1a6c91/68747470733a2f2f706f7365722e707567782e6f72672f676f7373692f737761676765722f646f776e6c6f616473)](https://packagist.org/packages/gossi/swagger)
[![HHVM Status](https://camo.githubusercontent.com/57d35c599552f4af13b7ba0676376d1c16f434701fc7ee6859dfc7da7f03e61e/687474703a2f2f6868766d2e683463632e64652f62616467652f676f7373692f737761676765722e7376673f7374796c653d666c6174)](http://hhvm.h4cc.de/package/gossi/swagger)[![Build Status](https://camo.githubusercontent.com/e1fba74ff56ddc8f3b906afdd33fabe1fffb342c0bcb9209aec92b484d8c0772/68747470733a2f2f7472617669732d63692e6f72672f676f7373692f737761676765722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/gossi/swagger)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/24796d7f29f4e136641d7403e5dfaa42e7e5b5e703b4ebf0668d7b43ff5feac5/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f676f7373692f737761676765722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/gossi/swagger/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/87c6e41f9d6bacc4d3a94823450f5a3e9df44f4a88bb08d6717dab1931342551/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f676f7373692f737761676765722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/gossi/swagger/?branch=master)

A php library to manipulate [swagger](http://swagger.io)/[Open API](https://openapis.org) specifications.

Installation
------------

[](#installation)

```
composer require gossi/swagger

```

Usage
-----

[](#usage)

Read an `api.json` file:

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

// or

$swagger = new Swagger($array);
```

### Collections

[](#collections)

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

```
$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`.

### Models

[](#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
------------

[](#contributing)

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

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity40

Moderate usage in the ecosystem

Community21

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~85 days

Total

5

Last Release

3470d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0b1ca3beb32834f0f6a4b66d7a695ecc01397aa92e9a97bd0ba5dd8aa14e0c6e?d=identicon)[gossi](/maintainers/gossi)

![](https://www.gravatar.com/avatar/fb5ce96caf1e78aeefa09e75b49f21cc5214729ac6a9a06b852cf5de1269e058?d=identicon)[cristianoc72](/maintainers/cristianoc72)

---

Top Contributors

[![gossi](https://avatars.githubusercontent.com/u/283700?v=4)](https://github.com/gossi "gossi (25 commits)")[![jacobemerick](https://avatars.githubusercontent.com/u/527814?v=4)](https://github.com/jacobemerick "jacobemerick (5 commits)")[![theinpu](https://avatars.githubusercontent.com/u/1495647?v=4)](https://github.com/theinpu "theinpu (1 commits)")

---

Tags

apiswagger

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/gossi-swagger/health.svg)

```
[![Health](https://phpackages.com/badges/gossi-swagger/health.svg)](https://phpackages.com/packages/gossi-swagger)
```

###  Alternatives

[adrenalinkin/swagger-resolver-bundle

Provides possibility for validate data according to Swagger documentation

1013.3k](/packages/adrenalinkin-swagger-resolver-bundle)[clever/clever-php

231.6k](/packages/clever-clever-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
