Skip to content

Instantly share code, notes, and snippets.

@martyn82
Last active July 12, 2017 13:08
Show Gist options
  • Save martyn82/aef27331533556fe9d73dc0fed4a84a7 to your computer and use it in GitHub Desktop.
Save martyn82/aef27331533556fe9d73dc0fed4a84a7 to your computer and use it in GitHub Desktop.
Simple local Swagger server
<?php
/**
* Simple Swagger server
* 1: Make sure your swagger file is in the same directory as this file; and it is named 'swagger.json'
* 2: Run php -S localhost:8001
*
* Open your browser to localhost:8001 and see that your swagger file is served.
* Now you can use this URL in a local SwaggerUI.
*/
header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json");
echo file_get_contents("swagger.json");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment