Since REST is the application of the same HTTP protocol methods to the client-server architecture design, and PHP is already so good at handling HTTP protocol requests such as GET and POST. PHP is especially suited to simplify the creation of REST services.
Remember that REST is an application of the same http templates that already exist.
So, if you have an application that does something like:
- HTML form
- PHP process
- HTML output in a table
So, to do this REST, you need:
Now the challenge is to create your API (functions and URLs), which you will create in order to be a friendly programmer.
In this case, I suggest you look at the flickr API , as the example is very convenient for developers, easy to guess and has good documentation.
For more information about the API, see this presentation: How to create a good API and why it matters (Joshua Bloch)
Finally, the RESTful API should also implement the PUT and DELETE methods of the http protocol when it makes sense.
For example, if you had a delete action in your api, the specified service should get a delete method from the http protocol. Instead of the more common thing of sending an action parameter as part of a submit request.
Edit: Replaced “Php by default by default” with “Since REST is an application of the same HTTP protocol methods for designing client-server architectures, and PHP is already so good for handling HTTP protocol requests such as GET and POST. PHP is specially suited to simplify the creation of REST services.
And they also added a final note that you should implement the appropriate PUT or DELETE methods when this action makes sense for your api.
elviejo79 Oct 27 '09 at 3:52 2009-10-27 03:52
source share