I reckon my problem is quite common but even with the mass of doc on namespacing I can't figure out what's wrong with my code.
So I'm using Slim 4.1 and I've put my workfiles in the folder Custom/
in the app/
folder.
public/
-- index.php
app/
-- Custom/
---- routes/
------ manage.route.php
-- routes.php
src/
I added this line to compose.json.
"autoload": {
"psr-4": {
"App\\": "src/",
"Custom\\": "app/Custom/" // my custom line
}
}
In routes.php I try to call my file using use
and the namespace of my files as follow:
use Custom\Routes\Manage as Manage;
and in my class's file:
namespace Custom\Routes\Manage;
at its top;
When I hit new Manage();
in routes.php I produce the folling error:
Class 'Custom\Routes\Manage' not found in '[directories]/routes.php'
I'm pretty sure composer loads the files as the number of files autoloaded changes when I remove the namespace calls.
Maybe I'm not calling my Class the right way, I truly don't know at this point. Could you point me the way ?
Thanks a lot in advance
Edits:
I also reloaded composer with composer dump-autoload -o
Composer is adding my folder so the problem isn't from there, it's written in vendor/composer/autoloader_psr4.php
'Custom\\' => array($baseDir . '/app/Custom')