Difference between #6 and #7 of
YII2: Create console commands inside a module or extension

Revision #7 has been created by Luis Armando on Jul 1, 2018, 12:49:07 AM with the memo:

moduleClass param must have quotes, if not it will throw - moduleClass: Module class must be properly namespaced.
« previous (#6)

Changes

Title unchanged

YII2: Create console commands inside a module or extension

Category unchanged

Tutorials

Yii version changed

2.0

Tags changed

yii2, config,tutorial, configyii2

Content changed

[...]
**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 ```
8 0
6 followers
Viewed: 66 226 times
Version: 2.0
Category: Tutorials
Written by: MetaCrawler
Last updated by: Luis Armando
Created on: Aug 6, 2015
Last updated: 6 years ago
Update Article

Revisions

View all history