'off'])->run([ './vendor/bin/openapi', 'app', // Server transfer endpoints are development-only (isDev()), so they stay out of the public docs. '--exclude', 'Http/Controllers/Api/ServerTransferController.php', '-o', 'openapi.yaml', '--version', '3.1.0', ]); foreach ([$process->errorOutput(), $process->output()] as $output) { $output = preg_replace('/^.*an object literal,.*$/m', '', $output); $output = preg_replace('/^\h*\v+/m', '', $output); echo $output; } $yaml = file_get_contents('openapi.yaml'); $json = json_encode(Yaml::parse($yaml), JSON_PRETTY_PRINT)."\n"; file_put_contents('openapi.json', $json); echo "Converted OpenAPI YAML to JSON.\n"; } }