PHP code example of uuf6429 / oas-php
1. Go to this page and download the library: Download uuf6429/oas-php 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/ */
uuf6429 / oas-php example snippets
$document = new \uuf6429\OpenAPI\Spec\Document();
$path = new \uuf6429\OpenAPI\Path();
$document->paths->set('/resource', $path);
$document = new Document();
$json = json_encode($document, JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT);
// save to file
file_put_contents('openapi.yaml', $json);
// or serve it out
header('Content-Type: application/x-yaml');
echo $json;