Ok, this one is bending my noobie-brain…
I’ve been experimenting with the $psr4 namespace, and, for demonstrating my problem, have the following (in Autoload.php):
Code:
$psr4 = [
'Config' => APPPATH . 'Config',
'App' => APPPATH,
'Libraries' => APPPATH . 'Libraries',
];
So one may be mistaken to believe that Libraries would be mapped (in the namespace and also in the file structure on the drive) as a sub-directory of the APPPATH (\app)…but if I use it as I’d have expected:
Code:
use Libraries\Functions;
// or, in case anyone thinks it’s now being referenced relative to \Config, the same happens with:
use \Libraries\Functions;
I get: “Error: Class 'Libraries\Functions' not found”.
If, however, I precede the reference to use with “\App”, as in:
Code:
use \App\Libraries\Functions;
everything works.
So the $psr4 definition doesn’t seem to be doing anything… indeed, if I remove ‘Libraries’ from Autoload.php, it makes no difference, and everything works without it.
What am I missing?
Thanks.
Gary