Reputation: 53
I know that my controller no find the instalation..so, whtat I have to do to included it??
So I run composer in my CI this github :https://github.com/yidas/codeigniter-rest
this project was install in /vendor/yidas/codeigniter-rest/
I created my controller like this :
class Rest_api extends yidas\rest\Controller {}
I receve this error:
Message: Class 'yidas\rest\Controller' not found
Filename: /var/www/html/realmoney/application/controllers/Rest_api.php
Backtrace:
File: /var/www/html/realmoney/index.php
Line: 293
Function: require_once
Upvotes: 0
Views: 199
Reputation: 11
I had the same issue at the beginning, but then I realized that I was installing it wrongly.
This happened to me:
When I run composer require yidas/codeigniter-rest
in application folder, I got these question:
No composer.json in current directory, do you want to use the one at C:\xampp\htdocs\ci3path? [Y,n]? n
I answered "Y", but I should have answered "n". This way, it will create a vendor folder in application, and not in ci3path.
After this, I just create a controller like this:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
use yidas\rest\Controller;
class Resource extends Controller {
public function index() {
return $this->response->json(['bar' => 'foo']);
}
}
Now it works.
Upvotes: 1