The configuration file rest.php does not exist.
Hi, I add codeigniter-restserver to my project using composer, and i direct it to dir 'application/vendor' on my composer.json file. but I get error: 'The configuration file rest.php does not exist.'
Hi @ryeoman, can you show me a code example how you include the project?
What i understand is, you included it via composer file, like
/codeigniter /codeigniter/application /codeigniter/application/composer.json <-- here?
And after you did composer update, it creates the /codeigniter/application/vendor folder, correct?
Did you enter the composer autoload file in your codeigniter config?
Hi @Hanisch-IT , Thanks for the reply before,
i use : use Restserver\Libraries\REST_Controller;
I have my composer.json file in:
/codeigniter/composer.json <-- here
I custom the composer.json file so that target directory for vendor like this:
/codeigniter/application/vendor
by adding this code:
"config": {
"vendor-dir": "application/vendor"
}
the composer autoload file was generated automatically when I do 'composer install': /codeigniter/application/vendor/autoload.php and I set $config['composer_autoload'] = TRUE;
Hi @ryeoman,
the library does not have a namespace. Try it without the use. And make sure that you set
$config['composer_autoload'] = realpath(APPPATH . '/vendor/autoload.php');
in your config.php
Hi @Hanisch-IT , sorry for my late reply.
I have set composer _autoload as your sugestion.
but I get this error:
Message: Class 'REST_Controller' not found
and in my controller I do this:
// This can be removed if you use __autoload() in config.php OR use Modular Extensions
/** @noinspection PhpIncludeInspection */
//require APPPATH . 'libraries/REST_Controller.php';
@ryeoman Your controller should be like this one:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Flights extends REST_Controller {
Your composer config line in application/config/config.php should be like this:
$config['composer_autoload'] = realpath(APPPATH . '../vendor/autoload.php');
That's it! I tested yesterday on new project that I started and it works.
Hi @ryeoman,
you dont need
require APPPATH . 'libraries/REST_Controller.php';
the composer autoload do all the file loadings for you. Only do what @farukgaric told you and you will be fine.
Regards
PS: Try to sorround your code blocks with
```php my php Code ```
then you will have a nice syntax highlighting
@farukgaric @Hanisch-IT , Thanks for the reply, but I still got same error:
The configuration file rest.php does not exist.
for now I will close this isue, I will try to see through my problem then, but if the problem still ocure i will ask again,
Thanks You
Did you find a solution? I'm having the same problem
I having the same problem! Any solution?
I "solved" this problem copying the rest.php file (rest server file) to folder application/config and copying the file Format.php (rest server file) to folder application/libraries.