New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

erasys/openapi-php

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

Larablocks Analysis

erasys/openapi-php works with Laravel 10 (latest release 4.0.0, Nov 3, 2023), which reached end of life on Feb 4, 2025: no more fixes, even for security.

Laravel 5 to 8 in earlier releases.

Recommendation checks

Use with care

Use with care: meets 0 of 4 checks.

  • Supports only Laravel 10, past end of life since Feb 4, 2025
  • No release in the last 12 months (last: Nov 3, 2023)
  • 4,579 downloads a month (needs 10,000)
  • 20 GitHub stars (needs 100)

State

Quiet
  • Last stable release: Nov 3, 2023.
  • No releases in the last 12 months.
  • First released: Apr 17, 2018.
  • Monthly downloads: 4,579, up 207% from six months ago.
  • 2 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Dec 1, 2026.

Install
composer require erasys/openapi-php
Latest Version:4.0.0
PHP:^8.2
Laravel:10
Older releases:5 – 8
License:MIT
Last Updated:Apr 17, 2025
Links: GitHub  ·  Packagist
Maintainer: erasys_webteam

openapi-php

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

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

This project is compliant with PSR-1, PSR-2 and PSR-4. If you notice compliance oversights, please send a patch via pull request.

Features

  • Fully documented object-oriented representation of the Open API 3.0+ specification with helper methods to write valid documents.
  • Supports Illuminate (Laravel) Jsonable and Arrayable.
  • 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

Via Composer

$ composer require erasys/openapi-php

Via Git

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

Usage

Basic example:

<?php

use erasys\OpenApi\Spec\v3 as OASv3;

$doc = new OASv3\Document(
    new OASv3\Info('My API', '1.0.0', 'My API description'),
    [
        '/foo/bar' => new OASv3\PathItem(
            [
                'get' => new OASv3\Operation(
                    [
                        '200' => new OASv3\Response('Successful response.'),
                        'default' => new OASv3\Response('Default error response.'),
                    ]
                ),
            ]
        ),
    ]
);

$yaml = $doc->toYaml();
$json = $doc->toJson();
$arr  = $doc->toArray();
$obj  = $doc->toObject();

Testing

$ composer test

or

$ vendor/bin/phpunit
$ vendor/bin/phpcs

Contributing

Please see CONTRIBUTING for details.

License

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

Alternatives to erasys/openapi-php

darkaonline/l5-swagger

OpenApi or Swagger integration to Laravel

45,592,628 2,932
kirschbaum-development/laravel-openapi-validator

Automatic OpenAPI validation for Laravel HTTP tests

1,581,876 58
scalar/laravel

Render your OpenAPI-based API reference

485,410 77
wotz/laravel-swagger-ui

Add Swagger UI to a Laravel application.

610,357 280
api-platform/laravel

API Platform support for Laravel

291,996 58

Version History

Version Released PHP Laravel License
4.0.0 ^8.2 ^10.14.1 MIT
3.4.0 ^7.4|^8.0 ^8.64 MIT
3.3.0 ^7.2|^8.0 ^7.0|^8.0 MIT
3.2.1 ^7.2|^8.0 ^7.0|^8.0 MIT
3.2.0 ^7.2|^8.0 ^7.0|^8.0 MIT