I am using Lithium Framework. I am trying to call class into a controller, that class is placed inside libraries folder.... But it is showing this error
Fatal error: Class 'app\libraries\Test' not found in /home/ali.mehdi/AvonTPH/app/controllers/SessionsagentController.php on line 34
In libraries folder I created Test.php having following code.
<?php
namespace app\libraries;
class Test{
public static function getTest(){
return "Hi";
}
}
Also Inside my controller.. I used following using statements:
use app\libraries\Test;
But Why Test Class not found... Am I missing something? Any Help would be appreciated.
As @Matei Mihai has commented, in your app\config\bootstrap\libraries.php
add the line Libraries::add('.')
, though I'd advise against this (see below).
Be aware that the best practice is to put your classes into a package and not drop them in the libraries
folder.