codeigniter-restserver icon indicating copy to clipboard operation
codeigniter-restserver copied to clipboard

Class 'REST_Controller' not found

Open aanik2007 opened this issue 9 years ago • 10 comments

Whenever I am extending the class. It is showing Class 'REST_Controller' not found

aanik2007 avatar Feb 03 '17 10:02 aanik2007

require(APPPATH . 'libraries/REST_Controller.php'); class Db extends \Restserver\Libraries\REST_Controller

That's how i have done it with my class and it works fine.You need to place the rest_controller in application/libraries

judemanutd avatar Feb 03 '17 12:02 judemanutd

only add use Restserver\Libraries\REST_Controller; after require APPPATH . '/libraries/REST_Controller.php';

fariswidhi avatar Feb 03 '17 13:02 fariswidhi

Fatal error: Class 'Restserver\Libraries\CI_Controller' not found in D:\Server\htdocs\CodeIgniter\application\libraries\REST_Controller.php on line 18

my REST_Controller class doesn't extend CI_Controller and generate error.

mahipal0015 avatar Jul 20 '18 13:07 mahipal0015

Hi @mahipal0015 Just add backslash before CI_Controller. abstract class REST_Controller extends \CI_Controller {

farukgaric avatar Jul 20 '18 13:07 farukgaric

@farukgaric after adding \slash An Error Was Encountered Non-existent class: Rest_controller???

ayeen avatar Jul 24 '18 07:07 ayeen

I solved this issue. Only do you have put this two lines in the controller:

use Restserver\Libraries\REST_Controller;
require(APPPATH . 'libraries/REST_Controller.php');

And the file REST_Controller.php, the first lines like this:

namespace Restserver\Libraries;
use CI_Controller;
use Exception;
use stdClass;
require APPPATH . 'libraries/Format.php';
defined('BASEPATH') OR exit('No direct script access allowed');

BrianDLA avatar Aug 08 '18 09:08 BrianDLA

Thanks this worked 👍 @BrianDLA

utsabshrestha avatar Aug 28 '18 05:08 utsabshrestha

This worked for me too. Thanks a bunch.

aasiimweDataCare avatar Sep 22 '18 12:09 aasiimweDataCare

Thanks this worked

SudarmawanAdyS avatar Apr 04 '19 08:04 SudarmawanAdyS

Solved Completely this Error Non-existent class: Format Thanks BrianDLA

Ashish123111 avatar Dec 26 '19 07:12 Ashish123111