My First Craft CMS Module

Module Class Autoloading and Bootstrapping

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 Com­pos­er knows about our new mod­ule and where its class­es are. So we have to edit the composer.json  file and add the name­space as a key and then the mod­ule loca­tion as the value.

"autoload": {
	"psr-4": {
		"craftquest\\": "modules/cqcontrolpanel/"
	}
}

After that we need to update the Craft appli­ca­tion con­fig file locat­ed in config/app.php and tell it about our new mod­ule. This will tell Craft about your mod­ule and then, option­al­ly, 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: