Useful Drupal Console commands examples

  • Posted on: 27 November 2018
  • By: stillfinder

Generate module

../vendor/bin/drupal generate:module --module=MyModuleName --uri=my-site.com
The command will create *.info.yml and *.module files with default content for my-site.com 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...