Class Or Framework To Help Build PHP RESTful API [closed]
I am looking to create a RESTFul PHP based API, and I am wondering if there are any good prebuilt REST server classes or frameworks?
Basically just want a class to handle routing, and finally, it should be able to return back JSON or XML. I don't care about the VERB types (GET, POST, PUT, DELETE), because for example, if somebody wants to delete a record, I want them to be able to simply type in a URL into their browser to delete. If you look at the VERB, and only allow DELETE, its means this inst possible.
An example, is that I want to be able to write a simple class like:
class Customers {
public function get($customer_id) {
//{ "response" : [ { "first" : "Bob", "last" : "Smith", "company" : "ABC Inc." } ] }
}
public function delete($customer_id) {
//{ "response" : "deleted" }
}
//POST
public function create($first_name, $last_name, $company) {
//{ "response" : "12322" }
}
}
Which would create the following routes:
/customers/get/12322
/customers/delete/12322
/customers/create *post data*
Thanks greatly.
See Fat-Free Framework, specifically F3::map()
I've used http://code.google.com/p/php-rest-api/ as a base on a couple of large scale project.
精彩评论