NOTE: This is the PHP version of this article and its companion app. A Java version is available here.
I have been looking for a lightweight framework to build a RESTful API in PHP. There are a number of good options out there: Slim, Epiphany, Tonic, Recess, and Frapi to name a few. They all seem like good frameworks. In the end, I chose Slim for this project for two main reasons:
- It’s very lightweight and focused on REST and nothing else.
- It supports all the HTTP methods (GET, POST, PUT, DELETE), which was a key requirement for my application.
This article (and its companion app) provides an example of building a complete RESTful API using the different HTTP methods:
- GET to retrieve and search data
- POST to add data
- PUT to update data
- DELETE to delete data
The application used as an example for this article is a Wine Cellar app. You can search for wines, add a wine to your cellar, update and delete wines.

You can run the application here. The create/update/delete features are disabled in this online version. Use the link at the bottom of this post to download a fully enabled version.
[Read more...]
RSS