We make sure our module code will run in the Craft application by updating the Composer autoloader files and adding it to the Craft bootstrap config.
Now we need to make sure Composer knows about our new module and where its classes are. So we have to edit the composer.json
file and add the namespace as a key and then the module location as the value.
"autoload": {
"psr-4": {
"craftquest\\": "modules/cqcontrolpanel/"
}
}
After that we need to update the Craft application config file located in config/app.php
and tell it about our new module. This will tell Craft about your module and then, optionally, load it on every request.
'modules' ['c-q-control-panel' => modules\craftquest\cqcontrolpanel\CQControlPanel::class
],
'bootstrap' => ['c-q-control-panel'],
My First Craft CMS Module is made up of the following videos: