Drupal Console

Getting the project

There are different ways to get the project on your local machine. Our recommendation for getting the project on your local machine is by using the installer.

Using the Drupal Console Installer

You can install the Drupal Console locally by running the installer in your project directory, the installer will take care of downloading the necesary files to run drupal console on you computer.

Using curl:

$ 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
    

Example:

$ php console.phar generate:module
    

You can place this file anywhere you wish. If you put it in your PATH, you can access it globally. On unixy systems you can even make it executable and invoke it without php.

Access console from anywhere on your system

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

Apply executable permissions on the downloaded file:

$ chmod +x /usr/local/bin/drupal
    

You can now execute console using:

$ drupal
    

NOTE: The name drupal is just an alias you can name it anything you like.

Install Drupal Console Using Composer

You can install this project using composer.

+

Install Drupal Console globally using composer:

$ composer global require drupal/console:@stable
    

Add the binary directory to your class path:

$ echo "PATH=$PATH:~/.composer/vendor/bin" >> ~/.bash_profile
    

You can now execute console using:

$ console generate:module
    

Download phar file

You can download the latest version of Console from the repository releases page at:

https://github.com/hechoendrupal/DrupalConsole

Make sure you download the console.phar file from the most current release.

Update project

Drupal 8 is under heavy development, to keep in sync with the latest changes. The easiest and recommended way of updating Drupal Console is using the self-update command.

Depending on the installation method:

Installed globally (and renamed to "drupal"):
$ drupal self-update
    
Installed globally (using composer):
$ composer global update drupal/console:@stable
    
Installed locally (running from directory where the console.phar has been downloaded):
$ php console.phar self-update
    

Available Drupal Console Commands

Note: Drupal Console commands *must* be run from the root of a Drupal 8 installation.

{% for namespace, commands in command_list %} {% if namespace != 'none' %} {% endif %} {% for command in commands %} {% endfor %} {% endfor %}
Drupal Console Command Details
{{ namespace }}
{{ command.name }} {{ command.description }}
{% if options|length>0 %}

Available options

{% for option in options %} {% endfor %}
Option Details
{{ option.name }} {{ option.description }}
{% endif %} {% if arguments|length>0 %}

Available arguments

{% for argument in arguments %} {% endfor %}
Argument Details
{{ argument.name }} {{ argument.description }}
{% endif %}