I would like to build a rest api and organise my code in subfolderslike that controller/api/1/
I tried with a simple test controller like this: test.php
<?php
class Controller_Test extends Controller_Rest
{
public function get_list()
{
return $this->response(array('foo'=>'bar'));
}
}
It works perfectly if I put the file is in controller folder but not in controller/api/1/. Should I configure some routes? Is it a bad practice to work like that?
I also tried to rename controller Controller_Api_1_Test.
Theoretically that should work fine. "Controller_Api_1_Test" should map to ./app/classes/controller/api/1/test.php.
The only thing I'm not sure about is if it likes the numeric part, we use "v1", "v2", etc in our applications, and I wonder if that is for a specific reason.