Is It Possible To Run Commands From A Different Location Than App/commands?

For instance, in a module or a package?

Answer: You can run commands in modules. BUT the module must be defined in your config, and you technically run controllers.


'modules' => [

    'mymodule' => [

        'class' => 'app\modules\mymodule\Module',




Then, you can run commands via the app/modules/mymodule/controllers directory.


$ php yii mymodule/test