Drupal Console is a command line tool derived from the Symfony Console and let's you debug, and interact with Drupal as well as create "boilerplate" code.

Once you've installed Drupal Console you should be able use it to create modules and services among other things. A nice time saver. This is how you install it. 

1. Use your Terminal to download the latest version of Drupal Console

curl https://drupalconsole.com/installer -L -o drupal.phar

2. Verify that the drupal.phar file works

php drupal.phar

This should result in a list with the available commands

Drupal Console Launcher 1.5.0

Usage:
  command [options] [arguments]

Options:
  -h, --help             Display this help message
  -q, --quiet            Do not output any message
  -V, --version          Display this application version
      --ansi             Force ANSI output
      --no-ansi          Disable ANSI output
  -n, --no-interaction   Do not ask any interactive question
  -e, --env[=ENV]        The Environment name [default: "prod"]
      --root[=ROOT]      Define the Drupal root to be used in command execution
      --debug            Switches on debug mode
      --learning         Generate a verbose code output
  -c, --generate-chain   Shows command options and arguments as yaml output to be used in chain command
  -i, --generate-inline  Shows command options and arguments as inline command
  -d, --generate-doc     Shows command options and arguments as markdown
  -t, --target[=TARGET]  Site name you want to interact with (for local or remote sites)
  -l, --uri=URI          URI of the Drupal site to use (for multi-site environments or when running on an alternate port)
  -y, --yes              Skip confirmation and proceed
  -v|vv|vvv, --verbose   Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
  about                     Displays basic information about Drupal Console project
  chain                     Chain command execution
  check                     System requirement checker
  exec                      Execute an external command.
  help                      Displays help for a command
  init                      Copy configuration files.
  list                      Lists all available commands
 debug
  debug:chain (dch)         List available chain files.
  debug:settings (dse)      List user Drupal Console settings.
  debug:site (dsi)          List all known local and remote sites.
 develop
  develop:contribute        Download Drupal + Drupal Console to contribute.
 quick
  quick:start               Download, install and serve a new Drupal project
 settings
  settings:set              Change a specific setting value in DrupalConsole config file
 site
  site:new                  Download a new Drupal project

3. Move the file to a place on your system where it can be globally executable, and change the permissions 

mv drupal.phar /usr/local/bin/drupal

chmod +x /usr/local/bin/drupal

4. Copy the configuration files to your user directory ($HOME or ~/)

drupal init

This will launch a series of y/n questions. I choose to say "yes" to all of them. Now you get this response:

Bash: Bash support depends on the http://bash-completion.alioth.debian.org/
project which can be installed with your package manager of choice. Then add
this line to your shell configuration file.
source "$HOME/.console/console.rc" 2>/dev/null

Bash or Zsh: Add this line to your shell configuration file:
source "$HOME/.console/console.rc" 2>/dev/null

Fish: Create a symbolic link
ln -s ~/.console/drupal.fish ~/.config/fish/completions/drupal.fish

Generated or updated files
 Generation path: phar:///usr/local/bin/drupal/bin/../
 1 - /Users/leanderl/.console/config.yml
 2 - /Users/leanderl/.console/console.rc
 3 - /Users/leanderl/.console/drupal.fish

                                                                                                                        
 Generated lines of code: 42

5. Configure the autocomplete features 

#Bash or Zsh: Add this line to your shell configuration file:
source "$HOME/.console/console.rc" 2>/dev/null

#Fish: Create a symbolic link
ln -s ~/.console/drupal.fish ~/.config/fish/completions/drupal.fish

6. If you need to update the Drupal Console, just run this command:

drupal self-update 

 

Source: https://drupalconsole.com/articles/how-to-install-drupal-console

Categories