PHPackages                             swaggest/swagger2-schema - 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. swaggest/swagger2-schema

ActiveLibrary[API Development](/categories/api)

swaggest/swagger2-schema
========================

Swagger 2.0 schema PHP mappings

v0.2.6(4y ago)610.7k↓28.6%1MITPHPCI failing

Since Mar 22Pushed 4y ago1 watchersCompare

[ Source](https://github.com/swaggest/php-swagger2-schema)[ Packagist](https://packagist.org/packages/swaggest/swagger2-schema)[ RSS](/packages/swaggest-swagger2-schema/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (13)Used By (1)

OpenAPI 3.0 and Swagger 2.0 schema PHP mappings
===============================================

[](#openapi-30-and-swagger-20-schema-php-mappings)

[![Build Status](https://camo.githubusercontent.com/79a648f3fb69494f86527376431295bf91ae8a5d357e31bc6c47699c253bff9e/68747470733a2f2f7472617669732d63692e6f72672f73776167676573742f7068702d73776167676572322d736368656d612e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/swaggest/php-swagger2-schema)[![codecov](https://camo.githubusercontent.com/2d16a1f5a89705c06ce38daaa433d45bb302e6aa1a8350c2cc85b94da637e296/68747470733a2f2f636f6465636f762e696f2f67682f73776167676573742f7068702d73776167676572322d736368656d612f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/swaggest/php-swagger2-schema)

Access and validate `OpenAPI 3.0` and `Swagger 2.0` schemas from PHP.

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

[](#installation)

```
composer require swaggest/swagger2-schema

```

Usage
-----

[](#usage)

### OpenAPI 3.0

[](#openapi-30)

```
// 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

[](#swagger-20)

```
// 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);
```

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~72 days

Recently: every ~156 days

Total

11

Last Release

1796d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/27acbd2504e91c838d403112493d8ae7b584c2d8d2f2ea7a9762ef764e35bc8c?d=identicon)[vearutop](/maintainers/vearutop)

---

Top Contributors

[![vearutop](https://avatars.githubusercontent.com/u/1381436?v=4)](https://github.com/vearutop "vearutop (34 commits)")

---

Tags

openapi3phpswagger

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/swaggest-swagger2-schema/health.svg)

```
[![Health](https://phpackages.com/badges/swaggest-swagger2-schema/health.svg)](https://phpackages.com/packages/swaggest-swagger2-schema)
```

###  Alternatives

[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)[hubspot/api-client

Hubspot API client

23914.2M16](/packages/hubspot-api-client)[lstrojny/fxmlrpc

Fast and tiny XML/RPC client with bridges for various HTTP clients

1425.4M30](/packages/lstrojny-fxmlrpc)

PHPackages © 2026

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