You have to navigate the file location of your namespace.
"autoload": {
"psr-0": { "MyNameSpace": "./<path to your parent directory>" }
}
For example, this is my directory structure:
composer.json
source
-Data
|-Controller
-Repository
Then, in the composer.json file:
"autoload": {
"psr-0": { "MyNameSpace": "source/Data" }
}
Then, I can define classes in these namespaces:
/* namespace for classes in controller directory */
namespace MyNameSpaceController;
/* namespace for classes in repository directory */
namespace MyNameSpaceRepository;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…