I am working with Luracast Restler API framework and am wondering how to organize the class structures to create this style of route.
webroot/user/:id/
webroot/user/:id/profile
webroot/user/:id/tweets
With the possibility of using GET, PUT, POST, DELETE for each:
Class user(){
function get($id){
Do something when GET/webroot/user/:id/
}
function put($data){
Do something when PUT/webroot/user/:data/
}
}
Class profile(){
function get($id){
Do something when GET/webroot/user/:id/profile
}
}
Class tweets(){
function get($id){
Do something when GET/webroot/user/:id/tweets
}
}
Thanks in advance!
You need to use custom url routing using the PHP Doc comments. Here is the modified example for your use case.
You can replace the method with POST, DELETE, PUT for profile editing. Also note that you can add more than one route using the syntax above.