Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Sameer Borate:
Create a quick REST API using Slim framework
Mar 16, 2015 @ 15:16:40

Sameer Borate has a quick tutorial posted showing how to create a basic REST API with Slim, the popular microframework for PHP.

During a recent client project, I frequently needed to access a remote database table and update the same for certain fields. This was accomplished using phpMyAdmin on the server. However, it was getting tedious and was prone to accidental updates and deletes. [...] This is all a tedious process and prone to errors. One solution was to create a quick REST api wrapper around the remote database, using which developers could update the database table without any risk of corrupting the data and also with the added benefit of updating the table programmatically.

He uses an example of working with student data (SQL for the table included) and helps you get Slim installed and working with an Apache install. He covers the overall structure of the API he's creating and the code to help make it happen. Obviously he doesn't share the entire codebase - that would be too large. He does show examples of GET and POST requests for the student data to give you something to work from. He finishes the post with a few simple cURL calls to make requests to the API and the responses.

tagged: rest api tutorial slim microframework example student

Link: http://www.codediesel.com/php/create-a-quick-rest-api-using-slim-framework/


Trending Topics: