PHPackages                             apiboard/php-openapi - 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. apiboard/php-openapi

ActiveLibrary[API Development](/categories/api)

apiboard/php-openapi
====================

OpenAPI Specification library for PHP 8. Supports both OAS 3.0 and 3.1.

2.1.3(7mo ago)64181MITPHPPHP &gt;=8.1CI failing

Since Mar 3Pushed 5mo ago2 watchersCompare

[ Source](https://github.com/APIboard/php-openapi)[ Packagist](https://packagist.org/packages/apiboard/php-openapi)[ RSS](/packages/apiboard-php-openapi/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (10)Versions (15)Used By (0)

PHP OpenAPI
===========

[](#php-openapi)

OpenAPI Specification parser for PHP 8. Supports both OAS 3.0 and 3.1.

[![Latest Version on Packagist](https://camo.githubusercontent.com/7ef020327e76f48daf15f19ad937183d497c298617267b0487742d62a639fdb9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f767072652f617069626f6172642f7068702d6f70656e6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/apiboard/php-openapi)[![PHP from Packagist](https://camo.githubusercontent.com/e5797808a8df6349a8eaa781a79f201fbd8b37a1d9fef0871228345bb7ad1aa8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f617069626f6172642f7068702d6f70656e6170693f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/e5797808a8df6349a8eaa781a79f201fbd8b37a1d9fef0871228345bb7ad1aa8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f617069626f6172642f7068702d6f70656e6170693f7374796c653d666c61742d737175617265)[![CI](https://github.com/apiboard/php-openapi/workflows/CI/badge.svg?style=flat-square)](https://github.com/apiboard/php-openapi/workflows/CI/badge.svg?style=flat-square)

Features
--------

[](#features)

- Parse OpenAPI files into a PHP object to interact with in code
- Validate OpenAPI files against the official JSON-schema descriptions
- Resolve external and internal references

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

[](#installation)

```
composer require apiboard/php-openapi
```

Usage
-----

[](#usage)

You can interact with this library through the `OpenAPI::class` directly.

```
$openAPI = new OpenAPI();
```

This class optionally accepts an implementation of `Apiboard\OpenAPI\Contents\Retriever::class` which will be used to retrieve the file contents. By default the local filesystem will be used to retrieve file contents.

### Parse

[](#parse)

You can parse the contents of a file by passing its path to `parse()`. This will attempt to retrieve the file's contents and resolve any external references.

It returns a PHP object that represents the OAS document structure that can be used in code.

```
$document = $openAPI->parse('/path/to/my-oas.json');

$document->openapi(); // 3.1.0
```

### Validate

[](#validate)

You can directly validate the contents of a file against the official OpenAPI JSON-schema descriptions. It returns an array of possible errors that occured during the validation.

```
$errors = $openAPI->validate('/path/to/my-oas.yaml');
```

> ⚠️ Validation for OAS 3.1 does not check any JSON Schemas in your OpenAPI document because it allows you to use any JSON Schema dialect you choose!

### Resolve

[](#resolve)

You can resolve external and internal references. It returns a PHP object with the resolved contents.

```
$contents = $openAPI->resolve('/path/to/my-oas.json');

$document = new Apiboard\OpenAPI\Structure\Document($contents);
```

When resolving references the contents will be retrieved from the local fileystem by default. You can override the way file contents is retrieved by passing a custom class that implements the `Apiboard\OpenAPI\Contents\Retriever` interface.

```
$customRetriever = new MyCustomRetriever();
$openAPI = new OpenAPI($customRetriever);

$openAPI->resolve('/path/to/my-oas.json');
```

Circular references are resolved as an internal reference after recursing twice, this is to prevent infinite recursion.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance68

Regular maintenance activity

Popularity18

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 99.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 ~73 days

Recently: every ~151 days

Total

14

Last Release

218d ago

Major Versions

1.0.5 → 2.0.02024-01-29

### Community

Maintainers

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

---

Top Contributors

[![beblife](https://avatars.githubusercontent.com/u/9271492?v=4)](https://github.com/beblife "beblife (225 commits)")[![tacman](https://avatars.githubusercontent.com/u/619585?v=4)](https://github.com/tacman "tacman (1 commits)")

---

Tags

openapiopenapi-specopenapi-specificationopenapi3php8

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/apiboard-php-openapi/health.svg)

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

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[silverstripe/framework

The SilverStripe framework

7213.5M2.5k](/packages/silverstripe-framework)[tempest/framework

The PHP framework that gets out of your way.

2.1k23.1k9](/packages/tempest-framework)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)

PHPackages © 2026

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