Search code examples
codeigniter-2

codeigniter rest server issue


i'm working with codeigniter rest server by phil sturgeon. I'm following net.tutsplus tutorial for restfull services here . I've installed the rest server locally and working intially to see how it works before installing it on server.

I'm having alot of problems from the starts. i included the REST_Controller.php file in my main controller and after that line when i do this :

 class Courses extends REST_Controller {

  function index (){
  $this->load->view('index');
  }

}

it gives error saying: Fatal error: Class 'REST_Controller' not found. But if i replace REST_Controller with CI_Controller it loads the index view. I'm stuck on this for 4 hours and nothing is working my way. need your advice guyz thnx in advance


Solution

  • From the docs: https://github.com/philsturgeon/codeigniter-restserver#installation

    Quick way would be to add before class Courses extends REST_Controller {

    require(APPPATH.'libraries/REST_Controller.php');
    

    Also, consider using __autoload Using the PHP spl_autoload_register() with Codeigniter

    HTH