Open API 3.0 builder and validation library for PHP that helps you write valid specs.
erasys/openapi-php is a Laravel package for open api 3.0 builder and validation library for php that helps you write valid specs..
It currently has 20 GitHub stars and 84.179 downloads on Packagist (latest version 4.0.0).
Install it with composer require erasys/openapi-php.
Discover more Laravel packages by erasys
or browse all Laravel packages to compare alternatives.
Last updated
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.
Jsonable
and Arrayable.Via Composer
$ composer require erasys/openapi-php
Via Git
$ git clone https://github.com/erasys/openapi-php.git
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();
$ composer test
or
$ vendor/bin/phpunit
$ vendor/bin/phpcs
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.