Our "RESTful" interface will consist of a few paths as follows:
GET /photos
: To load a list of all photosGET /photos/:id
: To load photos and informationGET /photos/country/:name
: To load a list of all photos that belong to a countryGET /photos/countries/
: To load a list of all the countriesPOST /photos
: To add a new photoDELETE /photos/:id
: To delete a photo
We can use one of the many "RESTful" frameworks out there to speed up building our application. I decided to use Slim, available at http://www.slimframework.com/, for its simplicity. To integrate it with our framework, we put the Slim library into the app\libs\
directory and load it from the rest_slim
module. This module, consisting of the class Rest_Slim
(in the app/rest_slim
directory), will also load the Responsive_Images
module and create database connections. The following constructor is responsible for creating the required environment:
private function __construct(...