PHP code example of paveljanda / php-openapi-specificaion-expander
1. Go to this page and download the library: Download paveljanda/php-openapi-specificaion-expander library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
paveljanda / php-openapi-specificaion-expander example snippets
use PavelJanda\OpenAPIExpander\OpenAPIExpander;
use Symfony\Component\Yaml\Yaml;
$specData = Yaml::parseFile(__DIR__ . '/openapiv3.yaml');
$expandedData = (new OpenAPIExpander)->expand($specData);
echo Yaml::dump($expandedData, 100, 2);
use PavelJanda\OpenAPIExpander\OpenAPIExpander;
$specData = json_decode(file_get_contents(__DIR__ . '/openapiv3.json'));
$expandedData = (new OpenAPIExpander)->expand($specData);
echo json_encode($expandedData, JSON_PRETTY_PRINT);