Yii Framework Forum: Is It Possible To Run Commands From A Different Location Than App/commands? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

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

#1 User is offline   amnah 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 143
  • Joined: 23-February 13

Posted 09 December 2013 - 09:55 PM

For instance, in a module or a package?
0

#2 User is offline   amnah 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 143
  • Joined: 23-February 13

Posted 10 December 2013 - 06:56 AM

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

Example:

'modules' => [
    'mymodule' => [
        'class' => 'app\modules\mymodule\Module',
        ...params...
    ]
]


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

app/modules/mymodule/controllers/TestController.php

$ php yii mymodule/test

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users