Installation and use commands from Drupal Console
Drupal console is a tool to help debug and develop Drupal projects and it runs on the CLI. Drupal console is meant for Drupal developers. Before you can use most commands of Drupal console, you must understand the structure of modules, themes and the Drupal architecture.
Drupal console is well integrated with well-known third-party components like Guzzle, Twig, and Dependency Injection among others.
It's easy to install Drupal Console! All you need to do is navigate to your Drupal project's folder and use composer (Incase you don't know what composer is you can just follow the guidelines from here https://getcomposer.org/download/). Just type the following commands :
“composer require drupal / console”
And your Drupal console will start installing. It usually takes one to three minutes to download, so please be patient.
Once composer has finished installing Drupal console, you can type the following command to check if your Drupal console is working
“{path to your drupal console} drupal”
Drupal Console comes with variety of commands like:
- Cache Commands
- Module Commands
- Image Commands
- User Commands
- Generate Commands
- Cron Commands
- Theme Commands
- Views Commands
- Translation Commands
- Site Commands
- Database Commands
- Create Commands
- Miscellaneous Commands
As a Drupal developer writing the same structure of code can be tedious and repetitive but by using these commands like "Module Commands", "Theme Commands", "Create Commands", and "Generate Commands" wa can create and finish projects with ease and haste. In addition to making the development of a project faster, Drupal console also has commands to help in debugging. As we know bugs and errors can happen anywhere, we can use "Database Commands'' and "Site Commands" to debug easily.
Drupal console can also be used to create your very own scaffolding for a command.
Here are some commonly used commands for development:
#Generate a new "FormBase"
$ drupal generate: form
#Generate a theme.
$ drupal generate: theme
#Generate a module.
$ drupal generate: module
#Rebuilds all caches
$ drupal cr all
#Create dummy nodes for your Drupal 8 application.
$ drupal create: nodes
You may explore more commands by typing :
# Lists all available commands
drupal list
Drupal Console is also constantly being developed, meaning to cope up with Drupal's updates, the developers have been actively updating Drupal Console as well. Some functions/commands and installation steps listed on this page might have been outdated. For more information on updates you may visit these sites
https://github.com/hechoendrupal/DrupalConsole
http://drupalconsole.com/
https://www.drupal.org/project/console