I have the following file structure:
- ajon/
- project/
- src/
- subproject1/
- index.php
- composer.json
- subproject2/
- composer.json
- subproject1/
- src/
- project/
In my composer.json I have:
"psr-4": {
"ajon\\project\\subproject1\\": "src/subproject1/",
"ajon\\project\\subproject2\\": "src/subproject2/"
}
Within subproject1 I have Models/Foo.php which looks like:
namespace ajon\project\subproject1\Models;
class Foo { ... }
within subproject1/index.php I have:
require_once 'vendor/autoload.php';
use ajon\project\subproject1\Models\Foo;
I am getting:
Class 'ajon\project\subproject1\Models\Foo' not found.
Will composer look for the
namespace ajon\project\subproject1
in the correct folder and then know to look inModels\Foo
from there?Am I doing something wrong?
- Is there a better way to do this?