Do API testing with Swagger-php/ui
Function:
1 swagger-php generate the API request rules according to custom rules, generate JSON files through Phar
2 Open swagger-ui/dist/index.html. Enter the JSON folder directory address (requires the same origin), Swagger-ui will generate the API according to the requested JSON, the page is very beautiful. Execution gets the return value when the request parameter is entered.
Disadvantage: The returned data cannot be validated. Features like Chrome's plugin postman.
API Action Test Reference code:
resource/postaction.php
Project description Information
info/api.php
Readme
# Usage of API docs### Raw Spec structure* info-general info.* model-entity class* resource-api endpoint### Compile API info.* After modify the spec, run shell script, as follows. ' CD Api-docs './gendocumentation.sh ' * The compiled content (. json) is stored in documentation/output/### View API docs* visit http://{domain}/documenation/
SH Execution file
#!/bin/sh. /swagger-php/swagger.phar. /output-docs-o. /documentation/output/