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.
- Fully documented object-oriented representation of the Open API 3.0+ specification with helper methods to write valid documents.
- Supports Illuminate (Laravel)
JsonableandArrayable. - 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.
Via Composer
$ composer require erasys/openapi-phpVia Git
$ git clone https://github.com/erasys/openapi-php.gitBasic example:
<?phpuseerasys\OpenApi\Spec\v3asOASv3;
$doc = newOASv3\Document(
newOASv3\Info('My API', '1.0.0', 'My API description'),
[
'/foo/bar' => newOASv3\PathItem(
[
'get' => newOASv3\Operation(
[
'200' => newOASv3\Response('Successful response.'),
'default' => newOASv3\Response('Default error response.'),
]
),
]
),
]
);
$yaml = $doc->toYaml();
$json = $doc->toJson();
$arr = $doc->toArray();
$obj = $doc->toObject();$ composer testor
$ vendor/bin/phpunit
$ vendor/bin/phpcsPlease see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.