I couldn't find an answer to this so I figured I could as well just ask.
First of all, here's little backstory so you get better understanding what I'm asking. I'm dealing with a legacy php project and new part of it will be separate from what already exists. Part of that is to create a REST api to transfer data between database and javascript.
Now what needs to be done: certain urls (everything with specific after root)(root/specific/class/method) will be redirected to index.php, which will sort out the request type, class and the method. Then use that part in interface class which would call out that class and its method.
So basically if the ajax request url was this: url/specific/user/all with type: GET, index.php would call out 'all' method from user class through the interface class.
Could someone please tell me how to achieve the index.php->interface->class part? I know how to sort out request type and url from the request but how do I take that information, pass it to interface class which then returns the answer from specific class and its method?
I know I didn't provide too much but if someone has experience with what I described above, please do tell.
Edit: little bit more information.
Ajax get request to: url/specific/user/all results in index.php getting these variables:
method: GET
request: user
key: all
And class user.php contains:
function all (){
}
How do I get from index.php to that specific function through interface class?