*Disclaimer*
Sorry if this has been discussed before, i tried searching, but i couldn't
find much information.

I probably have nowhere near the experience of you guys, so i apologize if
i overlooked something obvious. I'd like to hear if this is a good or a
terrible idea and the reasons behind it. I'm new to the world of core PHP
development, but if this makes sense, i could try working on this myself.

*Introduction*
The world of web dev has shifted a lot toward API development in the last
few years. Specifically - REST APIs are becoming the industry standard.
Among other things, one of the core principles of REST is to utilize all
HTTP methods - (GET, POST, PUT, PATCH, DELETE...).

*The problem*
Currently, PHP will parse the incoming HTTP request body only for GET
requests (and store the data in superglobal $_GET) and for POST requests
(and store the data in $_POST).
Additionally it will parse the data only for
*application/x-www-form-urlencoded* or *multipart/form-data *HTTP Content
types.
There are other 3rd party libraries and packages that enhance this and
enable parsing for other request methods and content types, but i feel like
this should have native support at this point.

*Goal*
Ideally, PHP should natively parse the incoming HTTP request body for all
request methods, not only for GET and POST. I guess that completely
replacing the $_POST and $_GET is out of the question as it would lead to
no backward compatibility. Maybe an additional superglobal could be
introduced ($_DATA)?


Thanks

Reply via email to