Last updated 10 July 2016. Created on 22 October 2014.
Edited by darol100, ceaucari, jmolivas, Eyal Shalev. Log in to edit this page.

The Drupal Console is a suite of tools that you run on a command line interface (CLI) to generate boilerplate code and interact with a Drupal 8 installation. For earlier versions of Drupal, see drush-related coder module tools.

Documentation

http://bit.ly/console-book

Support

http://bit.ly/console-support

Installation and use

# Run this in your terminal to get the latest Console version:
curl https://drupalconsole.com/installer -L -o drupal.phar

# Or if you don't have curl:
php -r "readfile('https://drupalconsole.com/installer');" > drupal.phar

# Accessing from anywhere on your system:
mv drupal.phar /usr/local/bin/drupal

# Apply executable permissions on the downloaded file:
chmod +x /usr/local/bin/drupal

# Copy configuration files to user home directory.
drupal init [--override]

# Create a new Drupal project
drupal site:new drupal8.dev 8.0.0

# Lists all available commands
drupal list

# Update to latest version.
drupal self-update

Available commands:

  _completion                       BASH completion hook.
  about                             Display basic information about Drupal Console project
  chain                             Chain command execution
  complete                          Shell completion command list
  cr                                Rebuild and clear all site caches.
  drush                             Run drush from console.
  help                              Displays help for a command
  init                              Copy configuration files to user home directory.
  list                              Lists commands22
  self-update                       Update the console to latest version.
  server                            Runs PHP built-in web server
 cache
  cache:rebuild                     Rebuild and clear all site caches.
 config
  config:debug                      Show the current configuration.
  config:edit                       Edit the selected configuration.
  config:export                     Export current application configuration.
  config:export:content:type        Export a specific content type and their fields.
  config:export:single              Export single configuration as yml file.
  config:export:view                commands.config.export.view.description
  config:import                     Import configuration to current application.
  config:import:single              Import the selected configuration.
  config:override                   Override config value in active configuration.
 container
  container:debug                   Displays current services for an application.
 cron
  cron:debug                        List of modules implementing a cron
  cron:execute                      Execute cron implementations by module or execute all crons
  cron:release                      Release cron system lock to run cron again
 database
  database:client                   Launch a DB client if it's available
  database:connect                  Launch a DB client if it's available
  database:dump                     Dump structure and contents of MySQL databases and tables
  database:log:clear                Remove events from DBLog table, filters are available
  database:log:debug                Display current log events for the application
  database:restore                  Restore structure and contents of MySQL databases and tables
 generate
  generate:authentication:provider  Generate an Authentication Provider
  generate:command                  Generate commands for the console.
  generate:controller               Generate & Register a controller
  generate:doc:dash                 Generate the DrupalConsole.docset package for Dash
  generate:doc:gitbook              Generate documentations for Commands
  generate:entity:bundle            Generate a new content type (node / entity bundle)
  generate:entity:config            Generate a new config entity
  generate:entity:content           Generate a new content entity
  generate:event:subscriber         Generate an event subscriber
  generate:form                     Generate a new "FormBase"
  generate:form:alter               Generate an implementation of hook_form_alter() or hook_form_FORM_ID_alter
  generate:form:config              Generate a new "ConfigFormBase"
  generate:module                   Generate a module.
  generate:permissions              Generate module permissions
  generate:plugin:block             Generate a plugin block
  generate:plugin:condition         Generate a plugin condition.
  generate:plugin:field             Generate field type, widget and formatter plugins.
  generate:plugin:fieldformatter    Generate field formatter plugin.
  generate:plugin:fieldtype         Generate field type plugin.
  generate:plugin:fieldwidget       Generate field widget plugin.
  generate:plugin:imageeffect       Generate image effect plugin.
  generate:plugin:imageformatter    Generate image formatter plugin.
  generate:plugin:rest:resource     Generate plugin rest resource
  generate:plugin:rulesaction       Generate a plugin rule action
  generate:plugin:type:annotation   Generate a plugin type with annotation discovery
  generate:plugin:type:yaml         Generate a plugin type with Yaml discovery
  generate:plugin:views:field       Generate a custom plugin view field.
  generate:routesubscriber          Generate a RouteSubscriber
  generate:service                  Generate service
  generate:theme                    Generate a theme.
 locale
  locale:language:add               Add a language to be supported by your site
  locale:language:delete            Delete a language to be supported by your site
  locale:translation:status         List available translation updates
 migrate
  migrate:debug                     Display current migration available for the application
  migrate:execute                   Execute a migration available for application
  migrate:setup                     Load and create the relevant migrations for a provided legacy database
 module
  module:debug                      Display current modules available for application
  module:download                   Download module or modules in application
  module:install                    Install module or modules in the application
  module:uninstall                  Uninstall module or modules in the application
 multisite
  multisite:debug                   List all multisites available in system
 rest
  rest:debug                        Display current rest resource for the application
  rest:disable                      Disable a rest resource for the application
  rest:enable                       Enable a rest resource for the application
 router
  router:debug                      Displays current routes for the application
  router:rebuild                    Rebuild routes for the application
 site
  site:debug                        List all known local and remote sites.
  site:install                      Install a Drupal project
  site:maintenance                  Switch site into maintenance mode
  site:mode                         Switch system performance configuration
  site:new                          Create a new Drupal project
  site:status                       View current Drupal Installation status
 test
  test:debug                        List Test Units available for the application.
  test:run                          Run Test unit from tests available for application
 theme
  theme:debug                       Displays current themes for the application
  theme:download                    Install theme or themes in the application
  theme:install                     Install theme or themes in the application
  theme:uninstall                   Uninstall theme or themes in the application
 update
  update:debug                      Display current updates available for the application
  update:execute                    Execute a specific Update N function in a module, or execute all
 user
  user:login:clear:attempts         Clear login failed attempts for an account.
  user:login:url                    Returns a one-time user login url.
  user:password:hash                Generate a hash from a plaintext password.
  user:password:reset               Reset password for a specific user.
 views
  views:debug                       Display current views resources for the application
  views:disable                     Disable a View
  views:enable                      Enable a View
 yaml
  yaml:diff                         Compare two YAML files in order to find differences between them.
  yaml:merge                        Merge one or more YAML files in a new YAML file. Latest values are preserved.
  yaml:split                        Split a YAML file using indent as separator criteria
  yaml:update:key                   Replace a YAML key in a YAML file.
  yaml:update:value                 Update a value for a specific key in a YAML file.

Drupal Console is on a very active development, meaning that this page might be outdate by the time you are reading it. For this reason we encourage you to look at these links where it will have more update information:

Find more information about this project at:

Join the conversation:

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.

Comments

mkolar’s picture

Hi, can someone help me? What is the correct config name (first parameter) for "drupal config:import:single" command? I want to import single confoguration via console. Thanks!

jmolivas’s picture

@mkolar:

Exporting single

$ drupal config:export:single system.site 

Import single

$ drupal config:import:single system.site  /path/to/system.site.yml

You can
* Use --help to see the command information or
* Visit the documentation https://hechoendrupal.gitbooks.io/drupal-console/content/en/commands/con...
* Ask on our support channel: https://gitter.im/hechoendrupal/DrupalConsole

NOTE: I am currently working on improving the config commands, fee free to add any issue or feature request at https://github.com/hechoendrupal/DrupalConsole/issues/new

matoeil’s picture

Could anyone tell me the windows install procedure?

jmolivas’s picture

Must be the same as other OS, are you experiencing an issue ?

# Run this in your terminal to get the latest Console version:  
curl https://drupalconsole.com/installer -L -o drupal.phar  

# Or if you don't have curl:  
php -r "readfile('https://drupalconsole.com/installer');" > drupal.phar
mhmd’s picture

What about moving those features inside drush or even being installed and run the commands as a drush command As many users used to drush

jmolivas’s picture

@mhmd: I spent a couple of days working with Greg Anderson a drush co-maintainer and he sent a PR based on the work we did:
https://github.com/drush-ops/drush/pull/1337 but not much traction generated and not yet commited.

This PR allows you to run Drupal Console command via drush as drush commands since it registers all of the Drupal Console commands as drush commands.

Fazeela_ma’s picture

I've a drupal module in 8, in which I've 5 modules and 2 taxonomies, which I've exported as configurations using drupal console. I'm creating these content types and taxonomies on installing the module, It is working fyn when I'm installing it through the UI. When I try drush it is not working. One of the content types is related to the taxonomy field. So it is showing some error like this. The Environment bundle (entity type: taxonomy_term) was deleted. As a result, the field_environment_db entity reference field [error] (entity_type: node, bundle: database_config) no longer has any valid bundle it can reference. The field is not working correctly anymore and has to be adjusted. So I would like to know whether we can tell the order in which the content types and taxonomies to be created

chill8331’s picture

Greetings,

I have version 0.9.8 installed. I got an exception of 'generate:form' command is not defined. I try to upgrade my installation with 'self-update' but the info i got is 'The latest version 0.9.8, was already installed on your system'. Anyone please help?

Thanks,

jmolivas’s picture

@chill8331 try using the installer to get the latest version

# Run this in your terminal to get the latest project version:
curl https://drupalconsole.com/installer -L -o drupal.phar

# Or if you don't have curl:
php -r "readfile('https://drupalconsole.com/installer');" > drupal.phar

# Accessing from anywhere on your system:
mv drupal.phar /usr/local/bin/drupal

# Apply executable permissions on the downloaded file:
chmod +x /usr/local/bin/drupal

More info and instructions at:
- https://drupalconsole.com/
- http://docs.drupalconsole.com/en/getting/installer.html

chill8331’s picture

@jmolivas, Thanks, it worked.

Just leave a note for anyone might encounter the same issue i do:
I download the newest version as the mannual. Run 'drupal list' command. The note saying 'try to run this under drupal project'. Then i switch to my 'www' folder to run it again.(I'm using windows7, and env path setup) Then i got some SQL error note.(It's quite strange i didn't aware what's going on.) After i checked everything, It turns out my WAMP is not start up yet... Start WAMP, It works as normal.

duvien’s picture

I'm trying to install DrupalConsole. Everything seems to have went ok. But running:

drupal check

nothing happens?

I used this method:

# Run this in your terminal to get the latest project version:
curl https://drupalconsole.com/installer -L -o drupal.phar

# Accessing from anywhere on your system:
mv drupal.phar /usr/local/bin/drupal

# Apply executable permissions on the downloaded file:
chmod +x /usr/local/bin/drupal

# Copy configuration files to user home directory:
drupal init --override

# Check and validate system requirements
drupal check

When i check error_log i see this:

[27-Jun-2016 18:25:30 UTC] PHP Fatal error: require(): Failed opening required 'drupal.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in phar:///usr/local/bin/drupal/bin/drupal on line 3

I'm installing on CentOS 7.2

Does anyone know what i'm missing or what i have done wrong? https://drupalconsole.com/ does not mention anything about drupal.php file?

-----------------------------------------------------------------
I build engaging websites and intuitive designs that will benefit your business
Duvien

duvien’s picture

We found a solution at: https://github.com/hechoendrupal/DrupalConsole/issues/1842

Someone mentioned disabling Ioncube Loader and that fixed this issue as well.

-----------------------------------------------------------------
I build engaging websites and intuitive designs that will benefit your business
Duvien

jmolivas’s picture

glad to read is fixed.

ec-adam’s picture

Thanks for the install instructions. I've got console running and most commands work perfectly.

drupal site:mode dev, however, always returns [ERROR] Command "site:mode", is not a valid command name.

Any thoughts/help?

darol100’s picture

For Drupal Console support you should ask in their Gitter channel - https://gitter.im/hechoendrupal/DrupalConsole

- Darryl Norris
Be Connected: Website | Twitter | LinkendIn | GitHub

ivel’s picture

According to this post the site:mode command has been removed.