Generate a Drupal module using the command line

Note Statistics

Note Statistics

  • Viewed 92 times
  • Bookmarked 1 times
  • 1 Grateful readers
Sun, 08/09/2020 - 18:13

Use the Drupal console to generate a new drupal module using the command below

drupal  gm --module <you module name>

or

drupal generate:module --module <your module name>

Interactive CLI Output

drupal generate:module --module my_awsesome_module

 // Welcome to the Drupal module generator

 Enter the module machine name [my_awsesome_module]:
 > 

 Enter the module Path [modules/custom]:
 > 

 Enter module description [My Awesome Module]:
 > Markdown editor for notes

 Enter package name [Custom]:
 > Default

 Enter Drupal Core version [8.x]:
 > 

 Do you want to generate a .module file? (yes/no) [yes]:
 > yes

 Define module as feature (yes/no) [no]:
 > no

 Do you want to add a composer.json file to your module? (yes/no) [yes]:
 > yes

 Would you like to add module dependencies? (yes/no) [no]:
 > no

 Do you want to generate a unit test class? (yes/no) [yes]:
 > no

 Do you want to generate a themeable template? (yes/no) [yes]:
 > no

 Do you want proceed with the operation? (yes/no) [yes]:
 > yes
Authored by