Drupal Console en PDF
Drupal Console en PDF
Console
Table of Contents
Drupal Console Documentation 0
What is the Drupal Console 1
Why should you care about? 1.1
How does Drupal Console help? 1.2
Where do I find the project? 1.3
Getting the project 2
Using the Installer 2.1
Using Composer 2.2
Download phar file 2.3
Update project 2.4
Using the project 3
How to copy configuration files 3.1
How to download, install and serve Drupal 8 3.2
How to use Drupal Console in a multi-site installation 3.3
How to use Drupal Console in a remote installation 3.4
Creating custom Commands 4
Registering Commands Automatically 4.1
Configuring the Command 4.2
Command Lifecycle 4.3
Getting Services from the Service Container 4.4
Contributing new features 5
Project requirements 5.1
Getting the project 5.2
Running the project 5.3
Keeping your fork up to date 5.4
Creating issues and pull requests 5.5
Contribute to this documentation 5.6
Available commands 6
about 6.1
chain 6.2
2
Drupal Console
help 6.3
settings:init 6.4
list 6.5
server 6.6
cache:rebuild 6.7
chain:debug 6.8
config:debug 6.9
config:diff 6.10
config:edit 6.11
config:export 6.12
config:export:content:type 6.13
config:export:single 6.14
config:export:view 6.15
config:import 6.16
config:import:single 6.17
config:override 6.18
config:settings:debug 6.19
container:debug 6.20
create:nodes 6.21
create:terms 6.22
create:users 6.23
create:vocabularies 6.24
cron:debug 6.25
cron:execute 6.26
cron:release 6.27
database:client 6.28
database:connect 6.29
database:dump 6.30
database:log:clear 6.31
database:log:debug 6.32
database:restore 6.33
database:table:debug 6.34
database:table:drop 6.35
generate:authentication:provider 6.36
3
Drupal Console
generate:command 6.37
generate:controller 6.38
generate:doc:dash 6.39
generate:doc:gitbook 6.40
generate:entity:bundle 6.41
generate:entity:config 6.42
generate:entity:content 6.43
generate:event:subscriber 6.44
generate:form 6.45
generate:form:alter 6.46
generate:form:config 6.47
generate:module 6.48
generate:permissions 6.49
generate:plugin:block 6.50
generate:plugin:condition 6.51
generate:plugin:field 6.52
generate:plugin:fieldformatter 6.53
generate:plugin:fieldtype 6.54
generate:plugin:fieldwidget 6.55
generate:plugin:imageeffect 6.56
generate:plugin:imageformatter 6.57
generate:plugin:rest:resource 6.58
generate:plugin:rulesaction 6.59
generate:plugin:type:annotation 6.60
generate:plugin:type:yaml 6.61
generate:plugin:views:field 6.62
generate:profile 6.63
generate:routesubscriber 6.64
generate:service 6.65
generate:theme 6.66
locale:language:add 6.67
locale:language:delete 6.68
locale:translation:status 6.69
4
Drupal Console
migrate:debug 6.70
migrate:execute 6.71
migrate:setup 6.72
module:debug 6.73
module:download 6.74
module:install 6.75
module:uninstall 6.76
multisite:debug 6.77
rest:debug 6.78
rest:disable 6.79
rest:enable 6.80
router:debug 6.81
router:rebuild 6.82
settings:check 6.83
settings:debug 6.84
settings:set 6.85
site:debug 6.86
site:install 6.87
site:maintenance 6.88
site:mode 6.89
site:new 6.90
site:statistics 6.91
site:status 6.92
state:debug 6.93
state:override 6.94
test:debug 6.95
test:run 6.96
theme:debug 6.97
theme:download 6.98
theme:install 6.99
theme:uninstall 6.100
translation:cleanup 6.101
translation:pending 6.102
translation:stats 6.103
5
Drupal Console
translation:sync 6.104
update:debug 6.105
update:execute 6.106
user:debug 6.107
user:delete 6.108
user:login:clear:attempts 6.109
user:login:url 6.110
user:password:hash 6.111
user:password:reset 6.112
views:debug 6.113
views:disable 6.114
views:enable 6.115
yaml:diff 6.116
yaml:merge 6.117
yaml:split 6.118
yaml:update:key 6.119
yaml:update:value 6.120
FAQ (Frequently Asked Questions) about Drupal Console 7
Installation problems 7.1
Permissions 7.2
Commands not listed 7.3
Interactive Mode 7.4
References 8
6
Drupal Console
Supporting organizations
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 a Drupal 8 module.
In addition, Drupal Console helps you interact with your Drupal installation.
Follow along in this documentation as we explore the power of this exciting new set of tools.
Learning Drupal 8
Drupal Console helps you learn Drupal 8. In addition to generating complex code, you can
increase the verbosity of the code comments, to better understand the generated code and
how to build on it, by using the --learning option.
Github repository
https://github.com/hechoendrupal/DrupalConsole
Documentation
http://hechoendrupal.gitbooks.io/drupal-console
Support chat
https://gitter.im/hechoendrupal/DrupalConsole
Our recommendation for getting the project on your local machine is by using the installer.
Using curl:
$ curl https://drupalconsole.com/installer -L -o drupal.phar
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.
$ mv drupal.phar /usr/local/bin/drupal
$ chmod +x /usr/local/bin/drupal
$ drupal
NOTE: The name drupal is just an alias you can name it anything you like.
Using Composer 15
Drupal Console
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.
$ drupal self-update
Update project 17
Drupal Console
Stand alone commands: These commands can run outside of a Drupal 8 site root.
Container aware commands: These commands must be run within a Drupal 8 site root.
NOTE: Possible messages when executing Drupal Console outside a Drupal site root and
no --root option provided.
When running the project outside of a Drupal 8 site root, the following message will be
shown.
In order to list all of the available commands, you should run this inside a drupal root
directory.
When running the project within of a Drupal 8 site root, but site is not yet installed, the
following message will be shown.
In order to list all of the available commands you should install drupal first.
DrupalConsole behaviour.
~/.console/
├── aliases.yml
├── chain
│ ├── quick-start.yml
│ └── sample.yml
├── config.yml
├── console.rc
├── drupal.fish
└── sites
└── sample.yml
NOTE: You must execute drupal init before in order to copy the
~/.console/chain/quick-start.yml on your system.
The chain command helps you to automate command execution, allowing you to define an
external YAML file containing the definition name, option and arguments of several
commands and execute that list based on the sequence defined in the file.
commands:
- command: site:new
arguments:
directory: drupal8.dev
version: 8.0.2
- command: site:install
options:
langcode: en
db-type: sqlite
db-file: sites/default/files/.ht.sqlite
site-name: 'Drupal 8 Quick Start'
site-mail: [email protected]
account-name: admin
account-mail: [email protected]
account-pass: admin
generate-inline: true
arguments:
profile: standard
- command: server
The previous configuration will execute several commands, in this case commands that will
download and install Drupal using SQLite, and finally start the PHP's built in server, now you
only need to open your browser and point it to 127.0.0.1:8088.
You can duplicate or make changes on the provided YAML file, to add commands for
download modules module:download , install modules module:install , import
configurations config:import and restore your database database:restore or any other
command provided by DrupalConsole or a custom command by your own module.
$ drupal multisite:debug
+---------------------+--------------------------------+
| Site | Directory |
+---------------------+--------------------------------+
| drupal8.dev | /var/www/drupal8.dev/default |
| drupal8.multi.dev | /var/www/drupal8.dev/multi.dev |
+---------------------+--------------------------------+
You can take advantage of this feature, using the --target option and passing the remote
site name you want to interact with.
Setting up your local computer to use a remote site requires a little configuration.
application:
...
remote:
user: root
port: 22
console: /usr/local/bin/drupal
options:
arguments:
keys:
public: ~/.ssh/id_rsa.pub
private: ~/.ssh/id_rsa
passphrase: ~/.ssh/passphrase.txt
local:
root: /var/www/drupal8.dev
host: local
dev:
root: /var/www/html/drupal
host: 140.211.10.62
user: drupal
prod:
root: /var/www/html/docroot
host: live.drupal.org
user: drupal
console: /var/www/html/docroot/console.phar
Debug sites.
You can list all known local and remote sites by executing the site:debug command.
$ drupal site:debug
+--------------------+-----------------+------------------------+
| Site | Host | Root |
+--------------------+-----------------+------------------------+
| sample.local | local | /var/www/drupal8.dev |
| sample.dev | 140.211.10.62 | /var/www/html/drupal |
| sample.prod | live.drupal.org | /var/www/html/docroot |
+--------------------+-----------------+------------------------+
You can show the site configuration details by passing the site name as argument to the
site:debug command.
user: drupal
port: 22
console: /usr/local/bin/drupal
options:
arguments:
keys:
public: ~/.ssh/id_rsa.pub
private: ~/.ssh/id_rsa
passphrase: ~/.ssh/passphrase.txt
root: /var/www/html/drupal
host: 140.211.10.62
remote: true
NOTE: As you may notice the global configuration and the specific site configuration are
merged when debugging a site. You can override any global configuration by adding those
keys on the site specific configuration.
$ drupal generate:command
Enter the Command Class. (Must end with the word 'Command'). [DefaultCommand]:
>
Is the command aware of the drupal site installation when executed?. (yes/no) [yes]:
>
Executing the generate:command passing inline options, make sure you adjust the following
command based on your requirements.
This command execution will generate a new Command class containing the boiler-plate
required to register a new command within your Drupal module.
Create a Command directory inside your module i.e. src/Command and create a PHP file
suffixed with Command.php i.e. MyCustomCommand.php for each command that you want to
provide.
Drupal Console provides two types of commands, stand alone and container aware
commands.
use Drupal\Console\Command\Command;
use Drupal\Console\Command\ContainerAwareCommand;
/**
* {@inheritdoc}
*/
protected function configure()
{
$this
->setName('user:login:url')
->setDescription($this->trans('commands.user.login.url.description'))
->addArgument(
'uid',
InputArgument::REQUIRED,
$this->trans('commands.user.login.url.options.uid'),
null
);
}
Command Lifecycle
Commands have three lifecycle methods:
Command Lifecycle 29
Drupal Console
Github-flavored Markdown
This documentation is written in “Github-flavored Markdown”, which is rendered on Github,
directly, as HTML. If you are already familiar with Markdown, GFL only adds a few useful
tweaks, otherwise you may want to read Github’s Markdown Basics primer.
Project requirements
Download Git
We recommend downloading Git from http://git-scm.com/downloads
Download Composer
Run this in your terminal to get the latest Composer version:
This installer script will simply check some php.ini settings, warn you if they are set
incorrectly, and then download the latest composer.phar in the current directory
You can run this terminal command to make Composer easily accessible, from anywhere on
your system:
$ mv composer.phar /usr/local/bin/composer
Download Drupal 8
The Drupal Console project only supports Drupal 8; which you will need to download and
install locally.
Download Drupal
Project requirements 32
Drupal Console
$ drupal server
NOTE: Make sure you use your own user and database credentials when running
site:install and never user root on production. In this example code, we accept all
Project requirements 33
Drupal Console
Fork
Fork your own copy of the Console repository to your account
Clone
Get a copy of your recently cloned version of console in your machine.
Install dependencies
Now that you have cloned the project, you need to download dependencies via Composer.
$ cd /path/to/DrupalConsole
$ composer install
$ bin/drupal
NOTE: The name drupal is just an alias you can name it anything you like.
To sync changes you make in a fork with the original repository, you should:
For detailed information please visit Github's guide Configuring a remote fork
Creating an Issue
If you found an issue or maybe you like to propose a new feature to the project, you need to
access the following link:
https://github.com/hechoendrupal/DrupalConsole/issues/new
https://github.com/hechoendrupal/DrupalConsole/blob/master/CONTRIBUTING.md
If you haven't yet contributed to a project on GitHub, or aren't still sure what the workflow
looks like, read the documentation about pull requests. You may also wish to download the
GitHub application (Mac | Windows, which simplifies the workflow a bit and provides a nice
GUI for your contributions).
container
Available commands 39
Drupal Console
create
create:nodes Create dummy nodes for your Drupal 8 application.
database
database:client Launch a DB client if it's available
database:connect Shows DB connection
database:dump Dump structure and contents of a database
Remove events from DBLog table, filters are
database:log:clear
available
database:log:debug Display current log events for the application
database:restore Restore structure and contents of a database.
database:table:debug Show all tables in a given database.
Available commands 40
Drupal Console
locale
locale:language:add Add a language to be supported by your site
migrate
Display current migration available for the
migrate:debug
application
module
Available commands 41
Drupal Console
state
state:debug Show the current State keys.
test
test:debug List Test Units available for the application.
Available commands 42
Drupal Console
views
views:debug Display current views resources for the application
yaml
Compare two YAML files in order to find differences
yaml:diff
between them.
Available commands 43
Drupal Console
Available options
Option Details
--no-
Do not ask any interactive question
interaction
--env The Environment name
--root Define the Drupal root to be used in command execution
--no-debug Switches off debug mode
--learning Generate a verbose code output
--generate- Shows command options and arguments as yaml output to be used in
chain chain command
--generate-
Shows command options and arguments as inline command
inline
--generate-
Shows command options and arguments as markdown
doc
--target Site name you want to interact with (for local or remote sites)
URI of the Drupal site to use (for multi-site environments or when running
--uri
on an alternate port)
Available arguments
Available commands 44
Drupal Console
Argument Details
Available commands 45
Drupal Console
about
The about command Display basic information about Drupal Console project
Usage:
$ drupal about
about 46
Drupal Console
chain
The chain command Chain command execution
Usage:
Available options
Option Details
--file User defined file containing commands to get executed.
chain 47
Drupal Console
help
The help command Displays help for a command
Usage:
Available options
Option Details
--xml To output list as XML
--raw To output raw command list
Available arguments
Argument Details
command_name The command name
help 48
Drupal Console
settings:init
The settings:init command Copy configuration files to user home directory.
Usage:
Available options
Option Details
--override Override configurations files
settings:init 49
Drupal Console
list
The list command Lists all available commands
Usage:
Available options
Option Details
--xml To output list as XML
--raw To output raw command list
Available arguments
Argument Details
namespace The namespace name
list 50
Drupal Console
server
The server command Runs PHP built-in web server
Usage:
Available arguments
Argument Details
address The address:port values
Examples
Run using default address argument value 127.0.0.1.8088
$ drupal server
Running default address argument values, using --root option to define the Drupal root
server 51
Drupal Console
cache:rebuild
The cache:rebuild command Rebuild and clear all site caches.
Usage:
Available arguments
Argument Details
cache Only clear a specific cache.
Examples
Rebuild all caches
$ drupal cr all
$ drupal cr discovery
cache:rebuild 52
Drupal Console
chain:debug
The chain:debug command List available chain files.
Usage:
$ drupal chain:debug
chain:debug 53
Drupal Console
config:debug
The config:debug command Show the current configuration.
Usage:
Available arguments
Argument Details
config-name Configuration name.
config:debug 54
Drupal Console
config:diff
The config:diff command Ouput configuration items that are different in active configuration
compared with a directory.
Usage:
Available options
Option Details
--reverse See the changes in reverse (i.e diff a directory to the active configuration).
Available arguments
Argument Details
The directory to diff against. If omitted, choose from Drupal config
directory
directories.
config:diff 55
Drupal Console
config:edit
The config:edit command Edit the selected configuration.
Usage:
Available arguments
Argument Details
config-name Configuration name.
editor Editor.
config:edit 56
Drupal Console
config:export
The config:export command Export current application configuration.
Usage:
Available options
Option Details
--directory Define the export directory to save the configuration output.
--tar If set, the configuration will be exported to an archive file.
config:export 57
Drupal Console
config:export:content:type
The config:export:content:type command Export a specific content type and their fields.
Usage:
Available options
Option Details
--module The Module name.
--optional- Export content type as an optional YAML configuration in your
config module
Available arguments
Argument Details
content-type Content Type to be exported
config:export:content:type 58
Drupal Console
config:export:single
The config:export:single command Export single configuration as yml file.
Usage:
Available options
Option Details
--directory Define the export directory to save the configuration output.
--include-dependencies Export dependencies of the configuration as well.
Available arguments
Argument Details
config-name Configuration name.
config:export:single 59
Drupal Console
config:export:view
The config:export:view command Export a view in YAML format inside a provided module
to reuse in other website.
Usage:
Available options
Option Details
--module The Module name.
Export view as an optional YAML configuration in your
--optional-config
module
--include-module-
Include module dependencies in module info YAML file
dependencies
Available arguments
Argument Details
view-id View ID
config:export:view 60
Drupal Console
config:import
The config:import command Import configuration to current application.
Usage:
Available options
Option Details
--file Path to an archive file of configuration to import.
--directory Path to a directory of configuration to import.
config:import 61
Drupal Console
config:import:single
The config:import:single command Import the selected configuration.
Usage:
Available arguments
Argument Details
config-name Configuration name.
input-file Path to the import files.
config:import:single 62
Drupal Console
config:override
The config:override command Override config value in active configuration.
Usage:
Available arguments
Argument Details
config-name Configuration name.
key Key
value Value
Examples
Set the Contact module flood limit to 10.
config:override 63
Drupal Console
config:settings:debug
The config:settings:debug command Displays current key:value on settings file.
Usage:
$ drupal config:settings:debug
config:settings:debug 64
Drupal Console
container:debug
The container:debug command Displays current services for an application.
Usage:
$ drupal container:debug
$ cod
container:debug 65
Drupal Console
create:nodes
The create:nodes command Create dummy nodes for your Drupal 8 application.
Usage:
Available options
Option Details
--limit commands.create.nodes.arguments.limit
--title-words commands.create.nodes.arguments.title-words
--time-range commands.create.nodes.arguments.time-range
Available arguments
Argument Details
content-types Content type(s) to be used in node creation
create:nodes 66
Drupal Console
create:terms
The create:terms command Create dummy terms for your Drupal 8 application.
Usage:
Available options
Option Details
--limit How many terms would you like to create
--name-words Maximum number of words in term names
Available arguments
Argument Details
vocabularies Vocabulary(s) to be used in terms creation
create:terms 67
Drupal Console
create:users
The create:users command Create dummy users for your Drupal 8 application.
Usage:
Available options
Option Details
--limit How many users would you like to create
--password Password to be set to users created
Available arguments
Argument Details
roles Role(s) to be used in user creation
create:users 68
Drupal Console
create:vocabularies
The create:vocabularies command Create dummy vocabularies for your Drupal 8
application.
Usage:
Available options
Option Details
--limit How many vocabularies would you like to create
--name-words Maximum number of words in vocabulary names
create:vocabularies 69
Drupal Console
cron:debug
The cron:debug command List of modules implementing a cron
Usage:
$ drupal cron:debug
cron:debug 70
Drupal Console
cron:execute
The cron:execute command Execute cron implementations by module or execute all crons
Usage:
Available arguments
Argument Details
module The Module name.
cron:execute 71
Drupal Console
cron:release
The cron:release command Release cron system lock to run cron again
Usage:
$ drupal cron:release
$ crr
cron:release 72
Drupal Console
database:client
The database:client command Launch a DB client if it's available
Usage:
Available arguments
Argument Details
database Database key from settings.php
database:client 73
Drupal Console
database:connect
The database:connect command Shows DB connection
Usage:
Available arguments
Argument Details
database Database key from settings.php
database:connect 74
Drupal Console
database:dump
The database:dump command Dump structure and contents of a database
Usage:
Available options
Option Details
--file commands.database.dump.option.file
Available arguments
Argument Details
database Database key from settings.php
database:dump 75
Drupal Console
database:log:clear
The database:log:clear command Remove events from DBLog table, filters are available
Usage:
Available options
Option Details
--type commands.database.log.clear.options.type
--severity commands.database.log.clear.options.severity
--user-id commands.database.log.clear.options.user-id
Available arguments
Argument Details
event-id commands.database.log.clear.arguments.event-id
database:log:clear 76
Drupal Console
database:log:debug
The database:log:debug command Display current log events for the application
Usage:
Available options
Option Details
--type Filter events by a specific type
--severity Filter events by a specific level of severity
Available arguments
Argument Details
event-id DBLog event ID
database:log:debug 77
Drupal Console
database:restore
The database:restore command Restore structure and contents of a database.
Usage:
Available options
Option Details
--file The filename for your database backup file
Available arguments
Argument Details
database Database key from settings.php
database:restore 78
Drupal Console
database:table:debug
The database:table:debug command Show all tables in a given database.
Usage:
Available arguments
Argument Details
database Database key from settings.php
database:table:debug 79
Drupal Console
database:table:drop
The database:table:drop command Drop all tables in a given database.
Usage:
Available arguments
Argument Details
database Database key from settings.php
database:table:drop 80
Drupal Console
generate:authentication:provider
The generate:authentication:provider command Generate an Authentication Provider
Usage:
Available options
Option Details
--module The Module name.
--class Authentication Provider class
--provider-id Provider ID
generate:authentication:provider 81
Drupal Console
generate:command
The generate:command command Generate commands for the console.
Usage:
Available options
Option Details
--module The Module name.
The Class that describes the command. (Must end with the word
--class
'Command').
--name The Command name.
--container-
Is the command aware of the drupal site installation when executed
aware
generate:command 82
Drupal Console
generate:controller
The generate:controller command Generate & Register a controller
Usage:
Available options
Option Details
--module The Module name.
--class Controller Class name
generate:controller 83
Drupal Console
generate:doc:dash
The generate:doc:dash command Generate the DrupalConsole.docset package for Dash
Usage:
Available options
Option Details
--path The path to the directory where the docset will be saved.
generate:doc:dash 84
Drupal Console
generate:doc:gitbook
The generate:doc:gitbook command Generate documentations for Commands
Usage:
Available options
Option Details
--path The path to render the documentation
generate:doc:gitbook 85
Drupal Console
generate:entity:bundle
The generate:entity:bundle command Generate a new content type (node / entity bundle)
Usage:
Available options
Option Details
--module The Module name.
--bundle-name The content type's machine name
generate:entity:bundle 86
Drupal Console
generate:entity:config
The generate:entity:config command Generate a new config entity
Usage:
Available options
Option Details
--module The Module name.
--entity-class The config entity class
generate:entity:config 87
Drupal Console
generate:entity:content
The generate:entity:content command Generate a new content entity
Usage:
Available options
Option Details
--module The Module name.
--entity-class The content entity class
generate:entity:content 88
Drupal Console
generate:event:subscriber
The generate:event:subscriber command Generate an event subscriber
Usage:
Available options
Option Details
--module The Module name.
--name commands.generate.service.options.name
generate:event:subscriber 89
Drupal Console
generate:form
The generate:form command Generate a new "FormBase"
Usage:
Available options
Option Details
--module The Module name.
--class The form class name
generate:form 90
Drupal Console
generate:form:alter
The generate:form:alter command Generate an implementation of hook_form_alter() or
hook_form_FORM_ID_alter
Usage:
Available options
Option Details
--module The Module name.
--form-id Form ID to alter
--inputs Create inputs in a form.
generate:form:alter 91
Drupal Console
generate:form:config
The generate:form:config command Generate a new "ConfigFormBase"
Usage:
Available options
Option Details
--module The Module name.
--class The form class name
generate:form:config 92
Drupal Console
generate:module
The generate:module command Generate a module.
Usage:
Available options
Option Details
--module The Module name
--machine-name The machine name (lowercase and underscore only)
generate:module 93
Drupal Console
generate:permissions
The generate:permissions command Generate module permissions
Usage:
Available options
Option Details
--module The Module name.
--permissions Create permissions.
generate:permissions 94
Drupal Console
generate:plugin:block
The generate:plugin:block command Generate a plugin block
Usage:
Available options
Option Details
--module The Module name.
--class Plugin class name
generate:plugin:block 95
Drupal Console
generate:plugin:condition
The generate:plugin:condition command Generate a plugin condition.
Usage:
Available options
Option Details
--module The Module name.
--class Plugin condition class name
generate:plugin:condition 96
Drupal Console
generate:plugin:field
The generate:plugin:field command Generate field type, widget and formatter plugins.
Usage:
Available options
Option Details
--module The Module name.
--type-class Field type plugin class name
generate:plugin:field 97
Drupal Console
generate:plugin:fieldformatter
The generate:plugin:fieldformatter command Generate field formatter plugin.
Usage:
Available options
Option Details
--module The Module name.
--class Plugin class name
generate:plugin:fieldformatter 98
Drupal Console
generate:plugin:fieldtype
The generate:plugin:fieldtype command Generate field type plugin.
Usage:
Available options
Option Details
--module The Module name.
--class Plugin class name
generate:plugin:fieldtype 99
Drupal Console
generate:plugin:fieldwidget
The generate:plugin:fieldwidget command Generate field widget plugin.
Usage:
Available options
Option Details
--module The Module name.
--class Plugin class name
generate:plugin:fieldwidget 100
Drupal Console
generate:plugin:imageeffect
The generate:plugin:imageeffect command Generate image effect plugin.
Usage:
Available options
Option Details
--module The Module name.
--class Plugin class name
generate:plugin:imageeffect 101
Drupal Console
generate:plugin:imageformatter
The generate:plugin:imageformatter command Generate image formatter plugin.
Usage:
Available options
Option Details
--module The Module name.
--class Plugin class name
generate:plugin:imageformatter 102
Drupal Console
generate:plugin:rest:resource
The generate:plugin:rest:resource command Generate plugin rest resource
Usage:
Available options
Option Details
--module The Module name.
--class Plugin Rest Resource class
--name commands.generate.service.options.name
--plugin-id Plugin Rest Resource id
--plugin-label Plugin Rest Resource Label
--plugin-url Plugin Rest Resource URL
--plugin-states Plugin Rest Resource States
generate:plugin:rest:resource 103
Drupal Console
generate:plugin:rulesaction
The generate:plugin:rulesaction command Generate a plugin rule action
Usage:
Available options
Option Details
--module The Module name.
--class Plugin class name
generate:plugin:rulesaction 104
Drupal Console
generate:plugin:type:annotation
The generate:plugin:type:annotation command Generate a plugin type with annotation
discovery
Usage:
Available options
Option Details
--module The Module name.
--class Plugin type class name
--machine-name commands.generate.plugin.type.annotation.options.plugin-id
--label Plugin type label
generate:plugin:type:annotation 105
Drupal Console
generate:plugin:type:yaml
The generate:plugin:type:yaml command Generate a plugin type with Yaml discovery
Usage:
Available options
Option Details
--module The Module name.
--class Plugin type class name
generate:plugin:type:yaml 106
Drupal Console
generate:plugin:views:field
The generate:plugin:views:field command Generate a custom plugin view field.
Usage:
Available options
Option Details
--module The Module name.
--class Views plugin field class name
generate:plugin:views:field 107
Drupal Console
generate:profile
The generate:profile command Generate a profile.
Usage:
Available options
Option Details
--profile The profile name
--machine-name The machine name (lowercase and underscore only)
generate:profile 108
Drupal Console
generate:routesubscriber
The generate:routesubscriber command Generate a RouteSubscriber
Usage:
Available options
Option Details
--module The Module name.
--name Service name
generate:routesubscriber 109
Drupal Console
generate:service
The generate:service command Generate service
Usage:
Available options
Option Details
--module The Module name.
--name commands.generate.service.options.name
generate:service 110
Drupal Console
generate:theme
The generate:theme command Generate a theme.
Usage:
Available options
Option Details
--theme commands.generate.theme.options.module
--machine-name The machine name (lowercase and underscore only)
--theme-path commands.generate.theme.options.module-path
--description Theme description
--core Core version
--package Theme package
--global-library Global styling library name
--base-theme Base theme (i.e. classy, stable)
--regions Regions
--breakpoints Breakpoints
generate:theme 111
Drupal Console
locale:language:add
The locale:language:add command Add a language to be supported by your site
Usage:
Available arguments
Argument Details
language Language for instance es or Spanish
locale:language:add 112
Drupal Console
locale:language:delete
The locale:language:delete command Delete a language to be supported by your site
Usage:
Available arguments
Argument Details
language Language for instance es or Spanish
locale:language:delete 113
Drupal Console
locale:translation:status
The locale:translation:status command List available translation updates
Usage:
Available arguments
Argument Details
language Language for instance es or Spanish
locale:translation:status 114
Drupal Console
migrate:debug
The migrate:debug command Display current migration available for the application
Usage:
Available arguments
Argument Details
tag Migrate tag
migrate:debug 115
Drupal Console
migrate:execute
The migrate:execute command Execute a migration available for application
Usage:
Available options
Option Details
--site-url Site Source URL
--db-type commands.migrate.setup.migrations.options.db-type
Available arguments
Argument Details
migrate:execute 116
Drupal Console
migrate:setup
The migrate:setup command Load and create the relevant migrations for a provided legacy
database
Usage:
Available options
Option Details
--db-type Drupal Database type
--db-host Database Host
--db-name Database Name
--db-user Database User
migrate:setup 117
Drupal Console
module:debug
The module:debug command Display current modules available for application
Usage:
Available options
Option Details
--status Module status [enabled disabled]
--type Module type [core no-core]
module:debug 118
Drupal Console
module:download
The module:download command Download module or modules in application
Usage:
Available options
Option Details
--latest Default to download most recent version
Available arguments
Argument Details
module Module or modules to be enabled should be separated by a space
module:download 119
Drupal Console
module:install
The module:install command Install module or modules in the application
Usage:
Available options
Option Details
--latest Default to download most recent version
Available arguments
Argument Details
module Module or modules to be enabled should be separated by a space
module:install 120
Drupal Console
module:uninstall
The module:uninstall command Uninstall module or modules in the application
Usage:
Available arguments
Argument Details
module Module or modules to be uninstalled should be separated by a comma
module:uninstall 121
Drupal Console
multisite:debug
The multisite:debug command List all multisites available in system
Usage:
$ drupal multisite:debug
multisite:debug 122
Drupal Console
rest:debug
The rest:debug command Display current rest resource for the application
Usage:
Available options
Option Details
--authorization Rest resource status enabled disabled
Available arguments
Argument Details
resource-id Rest ID
rest:debug 123
Drupal Console
rest:disable
The rest:disable command Disable a rest resource for the application
Usage:
Available arguments
Argument Details
resource-id Rest ID
rest:disable 124
Drupal Console
rest:enable
The rest:enable command Enable a rest resource for the application
Usage:
Available arguments
Argument Details
resource-id Rest ID
rest:enable 125
Drupal Console
router:debug
The router:debug command Displays current routes for the application
Usage:
Available arguments
Argument Details
route-name Route names
router:debug 126
Drupal Console
router:rebuild
The router:rebuild command Rebuild routes for the application
Usage:
$ drupal router:rebuild
$ ror
router:rebuild 127
Drupal Console
settings:check
The settings:check command System requirement checker
Usage:
$ drupal settings:check
$ check
settings:check 128
Drupal Console
settings:debug
The settings:debug command List user Drupal Console settings.
Usage:
$ drupal settings:debug
settings:debug 129
Drupal Console
settings:set
The settings:set command Change a specific setting value in DrupalConsole config file
Usage:
Available arguments
Argument Details
setting- Setting name in yaml flatten format to set a value in Drupal Console
name config file
setting-
Setting value to set in Drupal Console config file
value
settings:set 130
Drupal Console
site:debug
The site:debug command List all known local and remote sites.
Usage:
Available arguments
Argument Details
target commands.site.debug.options.target
site:debug 131
Drupal Console
site:install
The site:install command Install a Drupal project
Usage:
Available options
Option Details
--langcode Drupal language
--db-type Drupal Database type to be used in install
Available arguments
Argument Details
site:install 132
Drupal Console
site:maintenance
The site:maintenance command Switch site into maintenance mode
Usage:
Available arguments
Argument Details
mode Site maintenance mode[on/off]
site:maintenance 133
Drupal Console
site:mode
The site:mode command Switch system performance configuration
Usage:
Available arguments
Argument Details
environment Environment name [dev, prod]
site:mode 134
Drupal Console
site:new
The site:new command Create a new Drupal project
Usage:
Available arguments
Argument Details
directory Directory when downloading Drupal
version Drupal version to download
site:new 135
Drupal Console
site:statistics
The site:statistics command Show the current statistics of website.
Usage:
$ drupal site:statistics
site:statistics 136
Drupal Console
site:status
The site:status command View current Drupal Installation status
Usage:
Available options
Option Details
--format commands.site.status.options.format
site:status 137
Drupal Console
state:debug
The state:debug command Show the current State keys.
Usage:
Available arguments
Argument Details
key The State key to debug.
state:debug 138
Drupal Console
state:override
The state:override command Override a State key.
Usage:
Available arguments
Argument Details
key The State key to override.
value The State value to set.
state:override 139
Drupal Console
test:debug
The test:debug command List Test Units available for the application.
Usage:
Available options
Option Details
--test-class Test Class
Available arguments
Argument Details
group Group
test:debug 140
Drupal Console
test:run
The test:run command Run Test unit from tests available for application
Usage:
Available options
Option Details
--url commands.test.run.arguments.url
Available arguments
Argument Details
test-class Test Class
test-methods Test method(s) to be run
test:run 141
Drupal Console
theme:debug
The theme:debug command Displays current themes for the application
Usage:
Available arguments
Argument Details
theme Specific theme to debug
theme:debug 142
Drupal Console
theme:download
The theme:download command Download theme in application
Usage:
Available arguments
Argument Details
theme commands.theme.download.options.theme
version Theme version i.e 1.x-dev
theme:download 143
Drupal Console
theme:install
The theme:install command Install theme or themes in the application
Usage:
Available options
Option Details
--set-default Set theme as default theme
Available arguments
Argument Details
theme commands.theme.install.options.module
theme:install 144
Drupal Console
theme:uninstall
The theme:uninstall command Uninstall theme or themes in the application
Usage:
Available arguments
Argument Details
theme commands.theme.uninstall.options.module
theme:uninstall 145
Drupal Console
translation:cleanup
The translation:cleanup command Clean up translation files
Usage:
Available arguments
Argument Details
language Language to clean up files against English
translation:cleanup 146
Drupal Console
translation:pending
The translation:pending command Determine pending translation string in a language or a
specific file in a language
Usage:
Available options
Option Details
--file Specific file to determine pending translations against English
Available arguments
Argument Details
language Language to determine pending translations against English
translation:pending 147
Drupal Console
translation:stats
The translation:stats command Generate translate stats
Usage:
Available options
Option Details
--format Define output format table markdown
Available arguments
Argument Details
language Language to generate translation stats against English
translation:stats 148
Drupal Console
translation:sync
The translation:sync command Sync translation files
Usage:
Available options
Option Details
--file commands.translation.stats.options.file
Available arguments
Argument Details
language Language to syncronize against English source files
translation:sync 149
Drupal Console
update:debug
The update:debug command Display current updates available for the application
Usage:
$ drupal update:debug
$ upd
update:debug 150
Drupal Console
update:execute
The update:execute command Execute a specific Update N function in a module, or
execute all
Usage:
Available arguments
Argument Details
module The Module name.
update-n Specific Update N function to be executed
update:execute 151
Drupal Console
user:debug
The user:debug command Displays current users for the application
Usage:
Available options
Option Details
--roles Roles to filter debug
--limit How many users would you like to be listed in debug
user:debug 152
Drupal Console
user:delete
The user:delete command Delete users for the application
Usage:
Available options
Option Details
--user-id User id to be deleted
--roles Roles associated to users to be deleted
user:delete 153
Drupal Console
user:login:clear:attempts
The user:login:clear:attempts command Clear failed login attempts for an account.
Usage:
Available arguments
Argument Details
uid User ID.
user:login:clear:attempts 154
Drupal Console
user:login:url
The user:login:url command Returns a one-time user login url.
Usage:
Available arguments
Argument Details
user-id User ID.
user:login:url 155
Drupal Console
user:password:hash
The user:password:hash command Generate a hash from a plaintext password.
Usage:
Available arguments
Argument Details
password Password(s) in text format
user:password:hash 156
Drupal Console
user:password:reset
The user:password:reset command Reset password for a specific user.
Usage:
Available arguments
Argument Details
user User ID
password Password in text format
user:password:reset 157
Drupal Console
views:debug
The views:debug command Display current views resources for the application
Usage:
Available options
Option Details
--tag View tag
--status View status (Enabled Disabled)
Available arguments
Argument Details
view-id View ID
views:debug 158
Drupal Console
views:disable
The views:disable command Disable a View
Usage:
Available arguments
Argument Details
view-id View ID
views:disable 159
Drupal Console
views:enable
The views:enable command Enable a View
Usage:
Available arguments
Argument Details
view-id View ID
views:enable 160
Drupal Console
yaml:diff
The yaml:diff command Compare two YAML files in order to find differences between them.
Usage:
Available options
Option Details
--stats Print statistics about YAML files comparation
--negate Define mode diff or equal comparation, possible values TRUE/FALSE or 0/1
Available arguments
Argument Details
yaml-left YAML file used as base to compare
yaml-right YAML file used to find missing parts or differences with the base YAML file
yaml:diff 161
Drupal Console
yaml:merge
The yaml:merge command Merge two or more YAML files in a new YAML file. Latest values
are preserved.
Usage:
Available arguments
Argument Details
yaml-destination Path of new YAML file to store the result of merge.
yaml-files Path of YAML files to merge
yaml:merge 162
Drupal Console
yaml:split
The yaml:split command Split a YAML file using indent as separator criteria
Usage:
Available options
Option Details
--indent-level Split YAML file using a specific indent level
--file-output-prefix commands.yaml.split.options.file-output-prefix
--file-output-suffix commands.yaml.split.options.file-output-suffix
YAML Key from where start split - useful to extract partial
--starting-key
elements
--exclude-parents-
Exclude the "parents" key from the generated file
key
Available arguments
Argument Details
yaml-file commands.yaml.split.value.arguments.yaml-file
yaml:split 163
Drupal Console
yaml:update:key
The yaml:update:key command Replace a YAML key in a YAML file.
Usage:
Available arguments
Argument Details
yaml-file Path of YAML file to update
yaml-key YAML key to update
yaml-new-key commands.yaml.update.value.arguments.yaml-new-key
yaml:update:key 164
Drupal Console
yaml:update:value
The yaml:update:value command Update a value for a specific key in a YAML file.
Usage:
Available arguments
Argument Details
yaml-file Path of YAML file to update
yaml-key YAML key to update
yaml:update:value 165
Drupal Console
Installation problems
When you run DrupalConsole from your Drupal 8 root directory, you can get different error
messages, we will try to compile the reported issues and how to have them fixed.
Error message:
change it to read:
After you make the change, be sure to save the file and then run DrupalConsole again.
Error message:
[PDOException]
SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/tmp/mysql.sock'
ln -s /path/to/your/mysql/data/mysql.sock /tmp/mysql.sock
Error message:
This can be caused by the ioncube loader extension, which can be used to encode and
decode PHP files. This extension prevents normal working of any phar files with
require/include calls. You must disable the extension.
Warning message:
Your timezone is not set in php.ini; you must correct this by editing the appropriate php.ini for
the command line (there's a separate php.ini for the CLI).
Run php --ini and look for "Loaded Configuration File". For example, in Ubuntu:
;date.timezone =
If you see a command that is not yet described here, you are also welcome to contribute to
this documentation, using the --help output for the command as a simple starting point.
References
Documentation repository
https://github.com/hechoendrupal/drupal-console-book
Resources
Symfony Components
Drupal 8
PHP the right way
KNP University
Build a module
DrupalizeMe
Git
Composer
Box
References 169