I have created a module in modules/Core.php
which works great and I can reference it using modules\Core::class
. But I want to re-organise my modules.
I'm not super familiar with PSR-4 loading but I have taken a look at a bunch of modules to try and copy the file structure and composer file.
Here's the file structure I want:
modules
└── wrux
└── Core
├── README.md
├── composer.json
└── src
└── Core.php
Here's my modules/wrux/Core/composer.json
file:
{
"name": "wrux/Core",
"require": {
"craftcms/cms": "^3.2.0"
},
"autoload": {
"psr-4": {
"wrux\\Core\\": "src/"
}
}
}
After I run composer dump-autoload
I was hoping that I can use the wrux\Core
namespace but it's not working. My module is only accessible from then modules\wrux\Core\src
namespace.
Any ideas here?