YII2: Create console commands inside a module or extension

Comparing #4 with #7

Yii version

2.0

Tags

yii2, config,tutorial, configyii2

Content

[...]
**1) Create a new module in your application.** <br>
(I named it "example_commands" for this instructions)

Generate new module from commandline with gii (or use gii-webinterface)

```php
command> yii gii/module --moduleID=example_commands --moduleClass='app\modules\example_commands\Module'

Running 'Module Generator'...
[...]
app/modules/example_commands/Module.php


```php

namespace app\modules\example_commands;
[...]
app/modules/example_commands/commands/TestingController.php


```php

namespace app\modules\example_commands\commands;
[...]
app/config/console.php


```php

'bootstrap' => [
// ... other bootstrap components ...
[...]
moduleId/controller/action


```php
command>yii example_commands/testing/index hello world from module ```