slimphp / Slim

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs.
http://slimframework.com
MIT License
11.94k stars 1.95k forks source link

Auto endpoint documentation #1980

Closed Disane87 closed 7 years ago

Disane87 commented 8 years ago

Is there any way to auto generate an overview of all registered "endpoints"? I don't want to write an API.Doc for myself, instead I want slim to create that for me.

Is there any chance to get a proper overview?

JoeBengalen commented 8 years ago

You can get all registered routes from the router: Router::getRoutes() : Route[] https://github.com/slimphp/Slim/blob/3.x/Slim/Router.php#L237

You can use those to generate something you like.

Disane87 commented 8 years ago

Even with expected params?

Mit freundlichen Grüssen / Kind regards Marco Franke

\ Von meinem iPhone gesendet

Am 03.09.2016 um 20:01 schrieb Martijn Wennink notifications@github.com:

You van het All registered routes from the router

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

Disane87 commented 8 years ago

oh sorry, didnt noticed you had some links. Sorry for my first respond. Will check you link soon :)

cpats007 commented 7 years ago

I don't think there's a way of doing it automagically - but if this is something you're going to do regularly, you could use a config array to register your routes and then parse this array in a function to write your docs? Admittedly a lot longer than a quick fix you may have been hoping for but once done once, should be reusable in other projects?