klein / klein.php

A fast & flexible router
MIT License
2.66k stars 290 forks source link

Get PATCH or others PARAMS #384

Open URSELF-FR opened 6 years ago

URSELF-FR commented 6 years ago

Hi, I use your plugin in my RESTFUll project and I am using PATCH, PUT and DELETE methods. I configured the routes and I don't have any problems, but in my Controller, I was looking for the best way to use the params send with the request...

Example, in POST or in GET, I could use $request->params(), which gives me all the datas, but if I use PATCH or another it didn't work...

SO I used a pure php solution to receive my datas with : parse_str(file_get_contents('php://input'), $_PATCH); then I can access with $_PATCH.

Is there a way with your router to access theses datas? Like $request->getPatchParams(); or something like this??? Thanks for your answer.

rwrz commented 6 years ago

I think it should have somethng like this.