PHPackages                             bayfrontmedia/openapi-parser - 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. bayfrontmedia/openapi-parser

ActiveLibrary[API Development](/categories/api)

bayfrontmedia/openapi-parser
============================

PHP OpenAPI specification parser

v1.1.1(1y ago)135↓100%MITPHPPHP ^8.0

Since Aug 26Pushed 1y agoCompare

[ Source](https://github.com/bayfrontmedia/openapi-parser)[ Packagist](https://packagist.org/packages/bayfrontmedia/openapi-parser)[ Docs](https://github.com/bayfrontmedia/openapi-parser)[ RSS](/packages/bayfrontmedia-openapi-parser/feed)WikiDiscussions master Synced today

READMEChangelog (4)Dependencies (2)Versions (6)Used By (0)

OpenAPI Parser
--------------

[](#openapi-parser)

PHP OpenAPI specification parser.

This library supports [OAS 3.1](https://swagger.io/specification/#version-3.1.0), and resolves internal OpenAPI specification references. The OpenAPI specification can then be parsed into PHP objects.

- [License](#license)
- [Author](#author)
- [Requirements](#requirements)
- [Installation](#installation)
- [Usage](#usage)

License
-------

[](#license)

This project is open source and available under the [MIT License](LICENSE).

Author
------

[](#author)

[![Bayfront Media](https://camo.githubusercontent.com/0c0163913b2092e97dbf9684970adaf86f2f25871298d3d28b2dff4bf75b2915/68747470733a2f2f63646e312e6f6e62617966726f6e742e636f6d2f62666d2f6272616e642f62666d2d6c6f676f2e737667)](https://camo.githubusercontent.com/0c0163913b2092e97dbf9684970adaf86f2f25871298d3d28b2dff4bf75b2915/68747470733a2f2f63646e312e6f6e62617966726f6e742e636f6d2f62666d2f6272616e642f62666d2d6c6f676f2e737667)

- [Bayfront Media homepage](https://www.bayfrontmedia.com?utm_source=github&utm_medium=direct)
- [Bayfront Media GitHub](https://github.com/bayfrontmedia)

Requirements
------------

[](#requirements)

- PHP &gt;= 8.0 (Tested up to `8.4`)
- `yaml` PHP extension

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

[](#installation)

```
composer require bayfrontmedia/opanapi-parser

```

Usage
-----

[](#usage)

The `OpenApiSpec` class is used to parse JSON and YAML files into an array, as well as resolving any internal references.

The resolved specification array can then be used to create an `OpenApiObject` instance. All OpenAPI object class instances implement `ObjectInterface`.

The `ObjectInterface` includes a `getObject` method to return the entire object as an array, and a `validate()` method to validate against the OpenAPI specification, but all validation functions are currently rudimentary and should not be relied upon. It is advised to use this library with an OpenAPI specification which has already been tested as valid.

> NOTE: The `resolve` method can be quite slow depending on the size of the OpenAPI specification. It is strongly suggested to save/cache the resolved specification to use in production, or to only resolve parts of the specification as needed.

### Example

[](#example)

```
$object = OpenApiSpec::parseJson(file_get_contents('openapi-specification.json')); // Parse JSON

$openApiObject = new OpenApiObject($object);

$resolved = OpenApiSpec::resolve($openApiObject, $openApiObject->getObject()); // Resolve internal references (this file should be saved/cached)

// Get OperationObject by path and operation
$pathItemObject = $openApiObject->getPath('/user/login');
$operationObject = $path->getOperation($path::OPERATION_POST);

// Get OperationObject by operation ID
$operationObject = $openApiObject->getOperationObjectById('user.login')
```

To parse from a `.yaml` file, the `yaml` PHP extension must be installed to use the `yaml_parse` function.

Additional documentation coming soon.

###  Health Score

30

—

LowBetter than 67% of packages

Maintenance43

Moderate activity, may be stable

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 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 ~39 days

Total

4

Last Release

455d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5ad62c8d0e69358fd63b16fdaa71d5359231cd0cf660bbc3419071dc705c63a8?d=identicon)[bayfrontmedia](/maintainers/bayfrontmedia)

---

Top Contributors

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

---

Tags

apiswaggeropenapiparsebayfrontmedia

### Embed Badge

![Health badge](/badges/bayfrontmedia-openapi-parser/health.svg)

```
[![Health](https://phpackages.com/badges/bayfrontmedia-openapi-parser/health.svg)](https://phpackages.com/packages/bayfrontmedia-openapi-parser)
```

###  Alternatives

[swagger-api/swagger-ui

 Swagger UI is a collection of HTML, Javascript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.

28.7k44.1M90](/packages/swagger-api-swagger-ui)[darkaonline/l5-swagger

OpenApi or Swagger integration to Laravel

2.9k33.0M100](/packages/darkaonline-l5-swagger)[jolicode/slack-php-api

An up to date PHP client for Slack's API

2534.3M12](/packages/jolicode-slack-php-api)[darkaonline/swagger-lume

OpenApi or Swagger integration to Lumen

3332.3M3](/packages/darkaonline-swagger-lume)[harmbandstra/swagger-ui-bundle

Exposes swagger UI inside your Symfony project through a route (eg. /docs)

42860.5k](/packages/harmbandstra-swagger-ui-bundle)

PHPackages © 2026

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