Trouble with Custom Command in Custom Plugin. How do I do it? I found the documentation here very confusing: https://craftcms.com/docs/3.x/extend/commands.html#module-setup
I've scaffolded a simple test plugin from https://pluginfactory.io/ with &quot;Console Commands&quot; enabled and I've pulled my plugin into composer via 'path'. The plugin shows up fine in the Craft UI, and so I installed it.
However, I can't get the new command to display in the terminal when I do a 'php craft'. Am I supposed to see it?
You should see your commands when using the Craft CLI.
First thing to check would be that the module is registered in app.php, both in the modules and bootstrap arrays. Craft's documentation on that is here.
I find the best way to quickly validate that your module is registered, is by dumping something out from the module init() function. Craft::dd('Registered') does the trick. If you don't see anything on the frontend, your module isn't getting loaded into Craft.
Secondly, I would check that you are correctly setting the controllerNamespace, so that Craft knows where to look for controllers, depending on your request. Their documentation on that is here.
Finally, check that you have some valid functions setup in your controllers. Each function name should be prefixed with action. For example: actionRun() in a JobController.php file will be run with php craft mymodule/job/run.