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.98k stars 1.95k forks source link

Parse XML, JSON, CSV HTTP request body #113

Closed codeguy closed 12 years ago

codeguy commented 13 years ago

Parse GET, POST, PUT request parameters for JSON and XML content-types just as we do already for form-urlencoded requests.

codeguy commented 13 years ago

This link was provided by @silentworks as reference for this issue.

https://github.com/philsturgeon/codeigniter-restserver/blob/master/application/libraries/REST_Controller.php

danielhardy commented 13 years ago

It is not really the same thing but in similar vein I built a library of sorts to handle this by using the "Accept" header. Basically you can pass the name of a template and an array of data. It determines how to distribute the data (HTML/template, JSON, or XML) based on the request header. I have even wrote a Slim view file for a RESTful api I am building.

Again I realize that it is probably not what you are looking for but it might be an interesting way to do it. The project can be found at https://github.com/danielhardy/GNexus - (I am not much of a developer so please feel free to give me any feedback if you do check it out)

Cheers!

codeguy commented 13 years ago

Awesome. I have no idea if this will work, but I'll certainly take a look later tonight! Thanks.

codeguy commented 12 years ago

Considering this issue resolved with the Slim_Middleware_ContentTypes middleware class in v1.5.2. I will introduce this middleware in a blog post early this week.