Useful Drupal Console commands examples

  • Posted on: 27 November 2018
  • By: stillfinder

Generate module

../vendor/bin/drupal generate:module --module=MyModuleName
The command will create *.info.yml and *.module files with default content for inside modules/custom subdirectory.

Generate a controller with provided route

As a result, two files will be generated: modules/custom/custom_api/src/Controller/SearchController.php and modules/custom/custom_api/custom_api.routing.yml with the following content:

The article will be updated...