Auto documenting REST API in PHP

Greywire picture Greywire · Mar 15, 2011 · Viewed 43.6k times · Source

phpDocumentor seems to be the standard for documenting PHP code, though I have to wonder why it hasn't been updated in years..?

However, it does not seem suitable for documenting the entry points for a REST API; IE, externally accessible entry points that an end user of your system would be interested in, as opposed to documenting all the internal classes and such - something only of interest to the developers of the api.

I am looking for something where I could say, hey this method here is externally accessible through REST at this URL, here's the GET or POST arguments it takes, it supports GET/POST/etc HTTP methods, it returns JSON or XML or whatever.

This information would be able to produce an API document. It could also be used by the code internally to automatically filter inputs, validate output, create basic unit tests, etc.

Answer

fehguy picture fehguy · Aug 30, 2012

I know of 3 PHP integrations with swagger:

All should help auto-create a swagger-spec, which gives you access from swagger-ui. Then you can generate api clients, etc.