Download the PHP package apiboard/php-openapi without Composer
On this page you can find all versions of the php package apiboard/php-openapi. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download apiboard/php-openapi
More information about apiboard/php-openapi
Files in apiboard/php-openapi
Package php-openapi
Short Description OpenAPI Specification parser for PHP 8. Supports both OAS 3.0 and 3.1.
License MIT
Informations about the package php-openapi
PHP OpenAPI
OpenAPI Specification parser for PHP 8. Supports both OAS 3.0 and 3.1.
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
Usage
You can interact with this library through the OpenAPI::class
directly.
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
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.
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.
⚠️ 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
You can resolve external and internal references. It returns a PHP object with the resolved 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.
Circular references are resolved as an internal reference after recursing twice, this is to prevent infinite recursion.
License
The MIT License (MIT). Please see License File for more information.
All versions of php-openapi with dependencies
symfony/yaml Version ^6.1||^7.0
opis/json-schema Version ^2.3
symfony/filesystem Version ^6.2||^7.0