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

ActiveLibrary[API Development](/categories/api)

erasys/openapi-php
==================

Open API 3.0 builder and validation library for PHP that helps you write valid specs.

4.0.0(2y ago)2080.3k—5.6%14[2 PRs](https://github.com/erasys/openapi-php/pulls)4MITPHPPHP ^8.2

Since Apr 17Pushed 1y ago12 watchersCompare

[ Source](https://github.com/erasys/openapi-php)[ Packagist](https://packagist.org/packages/erasys/openapi-php)[ Docs](http://github.com/erasys/openapi-php)[ RSS](/packages/erasys-openapi-php/feed)WikiDiscussions master Synced 1mo ago

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

openapi-php
===========

[](#openapi-php)

[![Latest Version on Packagist](https://camo.githubusercontent.com/29a38bf325e050ef65d7d2c98b885de55c7c4507bf77ac862df92faa5f2bd3ef/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6572617379732f6f70656e6170692d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/erasys/openapi-php)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Build Status](https://camo.githubusercontent.com/2a130de797731eeb4a8160e8f83b09a9a0eba9aaa0e74e718bf0fb842ba1d960/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6572617379732f6f70656e6170692d7068702f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/erasys/openapi-php)[![Coverage Status](https://camo.githubusercontent.com/771fd97f5bb4b41669376e11dd6a568436ee39ab98038dca76da0663999a3d18/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6572617379732f6f70656e6170692d7068702e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/erasys/openapi-php/code-structure)[![Quality Score](https://camo.githubusercontent.com/16e67165c65d5fb203b0d973faf1a14b47bc79c9f1673bf62d0f460bff7ea7a9/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6572617379732f6f70656e6170692d7068702e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/erasys/openapi-php)[![Total Downloads](https://camo.githubusercontent.com/13db54c28171bcdb7a0c0d0a775a48e8b0e38d9c0224d9bda5d93f2d1b29bf20/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6572617379732f6f70656e6170692d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/erasys/openapi-php)

Open API 3.0 builder and validation library for PHP that helps you write valid specs.

This project is compliant with [PSR-1](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md), [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) and [PSR-4](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md). If you notice compliance oversights, please send a patch via pull request.

Features
--------

[](#features)

- Fully documented object-oriented representation of the [Open API 3.0+](https://github.com/OAI/OpenAPI-Specification/tree/master/versions) specification with helper methods to write valid documents.
- Supports Illuminate (Laravel) [`Jsonable`](https://github.com/illuminate/contracts/blob/v5.4.0/Support/Jsonable.php)and [`Arrayable`](https://github.com/illuminate/contracts/blob/v5.4.0/Support/Arrayable.php).
- Generates an specification in plain PHP arrays, plain objects, JSON or YAML.
- Validates Open API documents against the Open API 3.0.x JSON Schema.

Install
-------

[](#install)

Via Composer

```
$ composer require erasys/openapi-php
```

Via Git

```
$ git clone https://github.com/erasys/openapi-php.git
```

Usage
-----

[](#usage)

Basic example:

```
