mevdschee / php-crud-api

Single file PHP script that adds a REST API to a SQL database
MIT License
3.59k stars 1.01k forks source link

Custom Controller Documentation #766

Open akuehnis opened 3 years ago

akuehnis commented 3 years ago

CustomControllers are a great feature of the PHP-CRUD-API, they are just missing some documentation. Here's my suggestion:

https://gist.github.com/akuehnis/d1c305959040d900b059933b73ee0e76

mevdschee commented 3 years ago

Hi Adrian, Thank you for your contribution! I really like your custom controller documentation and example. Do you want me to add the documentation to the README or do you think it deserves it's own page? Kind regards, Maurits

akuehnis commented 3 years ago

Hi Maurits, you are welcome. I would integrate it into the readme, just like other the other features. However, after a day I have the feeling that I have packed too many examples into the controller file. Maybe just one route with one method would be even better. Regards Adrian

mevdschee commented 3 years ago

Did you consider adding a custom OpenAPI builder with the 'customOpenApiBuilders' config parameter? It would make the example even more complete!

niyonx commented 2 years ago

@akuehnis hey man, do you know how I can run custom SQL queries in the routes? Please share if you have an example, much appreciated!

zemian commented 2 years ago

I have a more simpler example here that might be good to add to the README doc. I suggest keep it short. Right now, it doesn't even mention users can have 'customControllers' config parameter.

(Thanks @akuehnis for the initial example!): https://github.com/zemian/php-crud-api/blob/zemian_my-examples/my-examples/my-custom-controllers.php