Installation and use php-swagger

swagger is a debugging tool interfaces of java, phper imitate he wrote php-swagger

composer require zircote/swagger-php

I use tp5.0, open the project's home directory, find the executable file openapi, examples can also be found in the Examples, and did write on it

 

 

  • Generating instructions yaml
  • yaml file after I wrote the memo files before compiling docs-dev home directory, where the compiler in public / docs in
php ./vendor/zircote/bin/openapi ./docs-dev/ -o ./public/docs
  • Use swagger-ui

github:https://github.com/swagger-api/swagger-ui

By introducing npm module I cloning directly down using the github

cd public
git clone https://github.com/swagger-api/swagger-ui

After cloning is complete, find index.html, the configuration file path yaml 

In line 42 can be configured yaml file path

 Then enter your own test server configured web site can be visited, for example, my server

 

 swagger like a postman can be as straightforward commissioning Oh, very convenient

 

Guess you like

Origin www.cnblogs.com/YC-L/p/12640216.html