I am trying to load my class through namespacing but Im struggling to find the right configuration and I keep getting a class not found error.
Here is the psr-4 property in my composer.json
"psr-4": {
"Namespaceone\": [
"src/core/Modules/Moduleone",
"src/core/Modules/Moduletwo",
],
"Volvo\": [
"src/programme/volvo/",
"src/programme/volvo/volvoxc"
]
}
Here is the file structure of src/programme/volvo:
- init.php //Contains new Volvo()
- Volvo.php //Class Volvo
- volvoxc/
- Volvoxc.php //Class Volvoxc extends Volvo
The files and classes:
init.php
$volvo = new Volvo(); //This returns all the properties from Volvo()
Volvo.php
namespace Volvo;
use Volvoxc;
class Volvo {
$volvoxc = new Volvoxc();
}
Volvoxc.php //This class can not be found
namespace Volvo;
class Volvoxc extends Volvo {}