What is Drupal console?
The command line interface for Drupal. In website development CLI perform lead role because with the use of command, we can make development rapidly. Drupal console provides us commands that will generate PHP code for projects like module, distribution, controller, etc. for Drupal 8.
The Drupal Console makes use of the Symfony Console and other third party components which allows you to automatically generate most of the code needed for Drupal 8 module.
Drupal Console allows us to debug routes, develop module and themes, plugin, event and many more components.
Why to use Drupal Console
It will generate the code and files for module with single line of command. It will
reduce the development time for tasks related to custom module or custom theme. It will provide modern technique for Drupal development.
Install Drupal console
Steps required to install Drupal console:
1) Download Drupal console using following command from terminal
$: curl https://drupalconsole.com/installer -L -o drupal.phar
2) Check downloaded file working properly
$: php drupal.phar
3) Move to a globally accessing path on your system
$: mv drupal.phar /usr/local/bin/drupal
4) Apply executable permissions
$: chmod +x /usr/local/bin/drupal
5) Run below command for generating configuration files to user home directory automatically.
$: drupal init
5) If you want to take advantage of Drupal console command as an autocomplete feature from terminal then execute below commands from home directory.
$: source “$HOME/.console/console.rc” 2>/dev/null
$: ln -s ~/.console/drupal.fish ~/.config/fish/completions/drupal.fish
Congratulations!!! You, just installed Drupal console on our system.
Note: If you want to allow your project use Drupal Console for selected projects from other projects then you need to run below command. This is done using Composer.
$: composer require drupal/console:~1.0 –prefer-dist –optimize-autoloader
It’s easy to install Drupal console and manage Drupal terminals . Questions or need assistance in Drupal, please contact one of our experts. cmsMinds is a Drupal Theme Development Company with depth and breadth of expertise in Drupal and other cms.