141

Click here to load reader

Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

Embed Size (px)

Citation preview

Page 1: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation
Page 2: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

0

1

1.1

1.2

1.3

2

2.1

2.2

2.3

2.4

3

3.1

3.2

3.3

3.4

4

4.1

4.2

4.3

4.4

4.5

4.6

4.7

4.8

4.9

4.10

4.11

4.12

4.13

4.14

TableofContentsDrupalConsoleDocumentation

WhatistheDrupalConsole

Whyshouldyoucareabout?

HowdoesDrupalConsolehelp?

WheredoIfindtheproject?

Gettingtheproject

UsingtheInstaller

UsingComposer

Downloadpharfile

Updateproject

Usingtheproject

Howtocopyconfigurationfiles

Howtodownload,installandserveDrupal8

HowtouseDrupalConsoleinamulti-siteinstallation

HowtouseDrupalConsoleinaremoteinstallation

Availablecommands

about

chain

drush

help

init

list

self-update

server

cache:rebuild

config:debug

config:edit

config:export

config:export:content:type

config:export:single

DrupalConsole

2

Page 3: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

4.15

4.16

4.17

4.18

4.19

4.20

4.21

4.22

4.23

4.24

4.25

4.26

4.27

4.28

4.29

4.30

4.31

4.32

4.33

4.34

4.35

4.36

4.37

4.38

4.39

4.40

4.41

4.42

4.43

4.44

4.45

4.46

4.47

4.48

config:export:view

config:import

config:import:single

config:override

container:debug

cron:debug

cron:execute

cron:release

database:client

database:connect

database:dump

database:log:clear

database:log:debug

database:restore

generate:authentication:provider

generate:command

generate:controller

generate:doc:dash

generate:doc:gitbook

generate:entity:bundle

generate:entity:config

generate:entity:content

generate:event:subscriber

generate:form

generate:form:alter

generate:form:config

generate:module

generate:permissions

generate:plugin:block

generate:plugin:condition

generate:plugin:field

generate:plugin:fieldformatter

generate:plugin:fieldtype

generate:plugin:fieldwidget

DrupalConsole

3

Page 4: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

4.49

4.50

4.51

4.52

4.53

4.54

4.55

4.56

4.57

4.58

4.59

4.60

4.61

4.62

4.63

4.64

4.65

4.66

4.67

4.68

4.69

4.70

4.71

4.72

4.73

4.74

4.75

4.76

4.77

4.78

4.79

4.80

4.81

generate:plugin:imageeffect

generate:plugin:imageformatter

generate:plugin:rest:resource

generate:plugin:rulesaction

generate:plugin:type:annotation

generate:plugin:type:yaml

generate:plugin:views:field

generate:routesubscriber

generate:service

generate:theme

locale:language:add

locale:language:delete

locale:translation:status

migrate:debug

migrate:execute

migrate:setup

module:debug

module:download

module:install

module:uninstall

multisite:debug

rest:debug

rest:disable

rest:enable

router:debug

router:rebuild

site:debug

site:install

site:maintenance

site:mode

site:new

site:status

test:debug

DrupalConsole

4

Page 5: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

4.82

4.83

4.84

4.85

4.86

4.87

4.88

4.89

4.90

4.91

4.92

4.93

4.94

4.95

4.96

4.97

4.98

4.99

4.100

5

5.1

5.2

5.3

5.4

5.5

5.6

6

6.1

6.2

6.3

6.4

7

test:run

theme:debug

theme:download

theme:install

theme:uninstall

update:debug

update:execute

user:login:clear:attempts

user:login:url

user:password:hash

user:password:reset

views:debug

views:disable

views:enable

yaml:diff

yaml:merge

yaml:split

yaml:update:key

yaml:update:value

ContributingtoDrupalConsole

Projectrequirements

Gettingtheproject

Runningtheproject

Keepingyourforkuptodate

Creatingissuesandpullrequests

Contributetothisdocumentation

FAQ(FrequentlyAskedQuestions)aboutDrupalConsole

Installationproblems

Permissions

Commandsnotlisted

InteractiveMode

References

DrupalConsole

5

Page 6: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

DrupalConsoleDocumentationNote:Thisprojectisawork-in-progress.

ThisbookdocumentstheDrupalConsoleproject.

ContributetotheprojectYoucancontributetoimprovethisprojectonGithub

ContributetothisdocumentationYoucancontributetoimprovethisdocumentationonGitHub.

Supportingorganizations

DrupalConsole

6DrupalConsoleDocumentation

Page 7: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

WhatistheDrupalConsole?TheDrupalConsoleisasuiteoftoolsrunfromacommandlineinterface(CLI)togenerateboilerplatecodeandinteractwithaDrupal8installation.Fromthegroundup,ithasbeenbuilttoutilizethesamemodernPHPpracticeswhichwereintroducedinDrupal8.

TheDrupalConsolemakesuseoftheSymfonyConsoleandotherthirdpartycomponentswhichallowsyoutoautomaticallygeneratemostofthecodeneededforaDrupal8module.Inaddition,DrupalConsolehelpsyouinteractwithyourDrupalinstallation.

DrupalConsole

7WhatistheDrupalConsole

Page 8: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

WhyshouldyoucareaboutitDrupal8ismoretechnicallyadvancedcomparedtoitspredecessorandmanagingtheincreasingcomplexityofDrupal8couldbeadauntingtaskforanyone.DrupalConsoleisasuiteoftoolstohelpmanagethatcomplexity.WritingaDrupal8modulenowinvolvesalotmoreboilerplatecodeandthereisalotyouneedtoknowanddojusttogetstartedbuildinganewmodule.Thesetaskscanberepetitiveandtedious,andcanthereforecreateincreasedpotentialforerrors.Fortunately,alotofthenewcodecanbeautomaticallygenerated,usingDrupalConsole,withoutriskofcopy/pasteerrorsandwithalotofsavedtime.

BenefitsoftheDrupalConsole:TakesadvantageoftheSymfonyConsoleandotherthird-partycomponentstogeneratePHP,YML,andotherfiles.Takesadvantageofothermoderndevelopmentpractices.Savesdevelopmenttime,bothduringmigrationofexistingDrupalmodulesandwhenwritingnewones.Provideseasy-to-learntoolsthatmakeDrupal8development,byextension,alsoeasiertolearn.ReducesdevelopmenttimeforremainingDrupal8tasksandfordevelopmentofnewmodules.

Followalonginthisdocumentationasweexplorethepowerofthisexcitingnewsetoftools.

DrupalConsole

8Whyshouldyoucareabout?

Page 9: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

HowdoesDrupalConsolehelp?

GeneratingthecodeandfilesrequiredbyaDrupal8moduleDrupalConsoleprovidesanumberofcommandsforcreatingmodulescaffoldingandboilerplatecode.Foranycommand,youwillbeaskedaseriesofquestionsaboutwhatyouwanttogenerate.Basedonthatuserinteraction,itwillthengeneratetherequiredboilerplatetobuildtherequestedcomponent.

InteractingwithyourDrupalinstallation.DrupalConsoleallowsyoutointeractwithyourDrupalinstallation,fromrebuildingcaches,tolistingroutes,services,andmodules,andinteractingwiththeconfigurationmanagement.

LearningDrupal8DrupalConsolehelpsyoulearnDrupal8.Inadditiontogeneratingcomplexcode,youcanincreasetheverbosityofthecodecomments,tobetterunderstandthegeneratedcodeandhowtobuildonit,byusingthe--learningoption.

DrupalConsole

9HowdoesDrupalConsolehelp?

Page 10: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

WheredoIfindtheproject?

Projectlandingpagehttp://drupalconsole.com

Githubrepositoryhttps://github.com/hechoendrupal/DrupalConsole

Documentationhttp://hechoendrupal.gitbooks.io/drupal-console

Supportchathttps://gitter.im/hechoendrupal/DrupalConsole

MoreinformationonDrupal.orgprojectpagehttps://drupal.org/project/console

DrupalConsole

10WheredoIfindtheproject?

Page 11: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

GettingtheprojectTherearedifferentwaystogettheprojectonyourlocalmachine.

Ourrecommendationforgettingtheprojectonyourlocalmachineisbyusingtheinstaller.

DrupalConsole

11Gettingtheproject

Page 12: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

UsingtheDrupalConsoleInstallerYoucaninstalltheDrupalConsolelocallybyrunningtheinstallerinyourprojectdirectory,theinstallerwilltakecareofdownloadingthenecesaryfilestorundrupalconsoleonyoucomputer.

Usingcurl:

$curl-LSshttp://drupalconsole.com/installer|php

Orifyoudon'thavecurl:

$php-r"readfile('http://drupalconsole.com/installer');"|php

Theinstallerscriptwillsimplychecksomephp.inisettings,warnyouiftheyaresetincorrectly,andthendownloadthelatestconsole.pharinthecurrentdirectory.

Youcannowexecuteconsoleusing:

$phpconsole.phargenerate:module

Youcanplacethisfileanywhereyouwish.IfyouputitinyourPATH,youcanaccessitglobally.Onunixysystemsyoucanevenmakeitexecutableandinvokeitwithoutphp.

Accessconsolefromanywhereonyoursystem

$mvconsole.phar/usr/local/bin/drupal

Youcannowexecuteconsoleusing:

$drupalgenerate:module

NOTE:Thenamedrupalisjustanaliasyoucannameitanythingyoulike.

DrupalConsole

12UsingtheInstaller

Page 13: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

DrupalConsole

13UsingtheInstaller

Page 14: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

InstallDrupalConsoleUsingComposerYoucaninstallthisprojectusingcomposer.

InstallDrupalConsolegloballyusingcomposer:

$composerglobalrequiredrupal/console:@stable

Addthebinarydirectorytoyourclasspath:

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

Youcannowexecuteconsoleusing:

$consolegenerate:module

DrupalConsole

14UsingComposer

Page 15: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

DownloadpharfileYoucandownloadthelatestversionofConsolefromtherepositoryreleasespageat:

https://github.com/hechoendrupal/DrupalConsole

Makesureyoudownloadtheconsole.pharfilefromthemostcurrentrelease.

DrupalConsole

15Downloadpharfile

Page 16: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

UpdateprojectDrupal8isunderheavydevelopment,tokeepinsyncwiththelatestchanges.TheeasiestandrecommendedwayofupdatingDrupalConsoleisusingtheself-updatecommand.

Dependingontheinstallationmethod:

Installedglobally(andrenamedto"drupal"):

$drupalself-update

Installedglobally(usingcomposer):

$composerglobalupdatedrupal/console:@stable

Installedlocally(runningfromdirectorywheretheconsole.pharhasbeendownloaded):

$phpconsole.pharself-update

DrupalConsole

16Updateproject

Page 17: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

UsingtheprojectDrupalConsoleprovidestwotypesofcommands,standaloneandcontainerawarecommands.

Standalonecommands:ThesecommandscanrunoutsideofaDrupal8siteroot.

Containerawarecommands:ThesecommandsmustberunwithinaDrupal8siteroot.

ExecutingDrupalConsoleoutsideaDrupalsiteroot

YoucanrunDrupalConsoleformanydirectoryonyoursystembyusingthe--rootoptiontodefinetheDrupalroottobeuseinthecommandexecution.

$drupal--root=/var/www/drupal8.devcrall

NOTE:PossiblemessageswhenexecutingDrupalConsoleoutsideaDrupalsiterootandno--rootoptionprovided.

WhenrunningtheprojectoutsideofaDrupal8siteroot,thefollowingmessagewillbeshown.

Inordertolistalloftheavailablecommands,youshouldrunthisinsideadrupalrootdirectory.

WhenrunningtheprojectwithinofaDrupal8siteroot,butsiteisnotyetinstalled,thefollowingmessagewillbeshown.

Inordertolistalloftheavailablecommandsyoushouldinstalldrupalfirst.

DrupalConsole

17Usingtheproject

Page 18: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

HowtocopyconfigurationfilesThefirsttaskyoushoulddoafterinstallingDrupalConsoleistoexecutetheinitcommand.Executingthiscommandwillcopytheprojectconfigurationsfilestoyour~/.console/directory.OverridingvaluesonthesecopiedfilesishowyoucanchangeDrupalConsolebehaviour.

$drupalinit[--override]

Whichfilesarecopiedwhenexecutingtheinitcommand.

~/.console/

├──aliases.yml

├──chain

│├──quick-start.yml

│└──sample.yml

├──config.yml

├──console.rc

├──drupal.fish

└──sites

└──sample.yml

DrupalConsole

18Howtocopyconfigurationfiles

Page 19: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

Howtodownload,installandserveDrupal8TheeasiestwaytotryDrupal8inyourlocalmachineisbyexecutingthechaincommandandpasstheoption--file=~/.console/chain/quick-start.ymlasshownonthefollowingexample.

$drupalchain--file=~/.console/chain/quick-start.yml

NOTE:Youmustexecutedrupalinitbeforeinordertocopythe~/.console/chain/quick-start.ymlonyoursystem.

Thechaincommandhelpsyoutoautomatecommandexecution,allowingyoutodefineanexternalYAMLfilecontainingthedefinitionname,optionandargumentsofseveralcommandsandexecutethatlistbasedonthesequencedefinedinthefile.

Thecontentoftheprovided~/.console/chain/quick-start.ymlfileis:

commands:

-command:site:new

arguments:

site-name:drupal8.dev

version:8.0.0

-command:site:install

options:

root:/Users/jmolivas/develop/drupal/sites/drupal8.dev

langcode:en

db-type:sqlite

db-file:sites/default/files/.ht.sqlite

site-name:'Drupal8QuickStart'

site-mail:[email protected]

account-name:admin

account-mail:[email protected]

account-pass:admin

generate-inline:true

arguments:

profile:standard

-command:server

Thepreviousconfigurationwillexecuteseveralcommands,inthiscasecommandsthatwilldownloadandinstallDrupalusingSQLite,andfinallystartthePHP'sbuiltinserver,nowyouonlyneedtoopenyourbrowserandpointitto127.0.0.1:8088.

DrupalConsole

19Howtodownload,installandserveDrupal8

Page 20: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

YoucanduplicateormakechangesontheprovidedYAMLfile,toaddcommandsfordownloadmodulesmodule:download,installmodulesmodule:install,importconfigurationsconfig:importandrestoreyourdatabasedatabase:restoreoranyothercommandprovidedbyDrupalConsoleoracustomcommandbyyourownmodule.

DrupalConsole

20Howtodownload,installandserveDrupal8

Page 21: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

HowtouseDrupalConsoleinamulti-siteinstallationDrupalConsoleprovidessupportforDrupalmulti-siteinstallations.Thisprojectprovidesthemultisite:debugcommandtodebugmulti-siteinstallationsandthe--urioptiontointeractwithmulti-siteinstallations.

Howtolistallknownmultisites

$drupalmultisite:debug

+---------------------+--------------------------------+

|Site|Directory|

+---------------------+--------------------------------+

|drupal8.dev|/var/www/drupal8.dev/default|

|drupal8.multi.dev|/var/www/drupal8.dev/multi.dev|

+---------------------+--------------------------------+

Sitesarewrittenusingtheformat:<port>.<domain>.<path>

Howtoexecuteacommandagainstamulti-siteinstallation

$drupal--uri=http://drupal8.multi.devcrall

DrupalConsole

21HowtouseDrupalConsoleinamulti-siteinstallation

Page 22: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

HowtouseDrupalConsoleinaremotesiteinstallationDrupalConsoleallowsyoutoruncommandsonyourlocalserverbutactuallyexecutethemonaremoteserver.

Settingupyourlocalcomputertousearemotesiterequiresalittleconfiguration.

Editglobalconfiguration

Youcanprovideglobalconfigurationtoremoteconnectionsatthecopiedfile~/.console/config.yml.Thisinformationisgroupedwithintheremotekey.

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

Editspecificsiteconfiguration

Youcanprovidespecificsiteconfigurationbyduplicatingthecopiedsitefileat~/.console/sites/sample.ymlwithanewsameat~/.console/sites/.

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

DrupalConsole

22HowtouseDrupalConsoleinaremoteinstallation

Page 23: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

Debugsites.

Youcanlistallknownlocalandremotesitesbyexecutingthesite:debugcommand.

$drupalsite: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|

+--------------------+-----------------+------------------------+

Youcanshowthesiteconfigurationdetailsbypassingthesitenameasargumenttothesite:debugcommand.

$drupalsite:debugsample.dev

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:Asyoumaynoticetheglobalconfigurationandthespecificsiteconfigurationaremergedwhendebuggingasite.Youcanoverrideanyglobalconfigurationbyaddingthosekeysonthesitespecificconfiguration.

DrupalConsole

23HowtouseDrupalConsoleinaremoteinstallation

Page 24: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

AvailableDrupalConsoleCommandsNote:DrupalConsolecommandsmustberunfromtherootofaDrupal8installation.

DrupalConsoleCommand Details

about DisplaybasicinformationaboutDrupalConsoleproject

chain Chaincommandexecution

drush Rundrushfromconsole.

help Displayshelpforacommand

init Copyconfigurationfilestouserhomedirectory.

list Listscommands22

self-update Updatetheconsoletolatestversion.

server RunsPHPbuilt-inwebserver

cache

cache:rebuild Rebuildandclearallsitecaches.

config

config:debug Showthecurrentconfiguration.

config:edit Edittheselectedconfiguration.

config:export Exportcurrentapplicationconfiguration.

config:export:content:type Exportaspecificcontenttypeandtheirfields.

config:export:single Exportsingleconfigurationasymlfile.

config:export:view commands.config.export.view.description

config:import Importconfigurationtocurrentapplication.

config:import:single Importtheselectedconfiguration.

config:override Overrideconfigvalueinactiveconfiguration.

container

container:debug Displayscurrentservicesforanapplication.

cron

cron:debug Listofmodulesimplementingacron

cron:executeExecutecronimplementationsbymoduleorexecuteallcrons

DrupalConsole

24Availablecommands

Page 25: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

cron:release Releasecronsystemlocktoruncronagain

database

database:client LaunchaDBclientifit'savailable

database:connect LaunchaDBclientifit'savailable

database:dump DumpstructureandcontentsofMySQLdatabasesandtables

database:log:clear RemoveeventsfromDBLogtable,filtersareavailable

database:log:debug Displaycurrentlogeventsfortheapplication

database:restore RestorestructureandcontentsofMySQLdatabasesandtables

generate

generate:authentication:provider GenerateanAuthenticationProvider

generate:command Generatecommandsfortheconsole.

generate:controller Generate&Registeracontroller

generate:doc:dash GeneratetheDrupalConsole.docsetpackageforDash

generate:doc:gitbook GeneratedocumentationsforCommands

generate:entity:bundle Generateanewcontenttype(node/entitybundle)

generate:entity:config Generateanewconfigentity

generate:entity:content Generateanewcontententity

generate:event:subscriber Generateaneventsubscriber

generate:form Generateanew"FormBase"

generate:form:alter Generateanimplementationofhook_form_alter()orhook_form_FORM_ID_alter

generate:form:config Generateanew"ConfigFormBase"

generate:module Generateamodule.

generate:permissions Generatemodulepermissions

generate:plugin:block Generateapluginblock

generate:plugin:condition Generateaplugincondition.

generate:plugin:field Generatefieldtype,widgetandformatterplugins.

generate:plugin:fieldformatter Generatefieldformatterplugin.

generate:plugin:fieldtype Generatefieldtypeplugin.

generate:plugin:fieldwidget Generatefieldwidgetplugin.

DrupalConsole

25Availablecommands

Page 26: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

generate:plugin:imageeffect Generateimageeffectplugin.

generate:plugin:imageformatter Generateimageformatterplugin.

generate:plugin:rest:resource Generatepluginrestresource

generate:plugin:rulesaction Generateapluginruleaction

generate:plugin:type:annotation Generateaplugintypewithannotationdiscovery

generate:plugin:type:yaml GenerateaplugintypewithYamldiscovery

generate:plugin:views:field Generateacustompluginviewfield.

generate:routesubscriber GenerateaRouteSubscriber

generate:service Generateservice

generate:theme Generateatheme.

locale

locale:language:add Addalanguagetobesupportedbyyoursite

locale:language:delete Deletealanguagetobesupportedbyyoursite

locale:translation:status Listavailabletranslationupdates

migrate

migrate:debug Displaycurrentmigrationavailablefortheapplication

migrate:execute Executeamigrationavailableforapplication

migrate:setup Loadandcreatetherelevantmigrationsforaprovidedlegacydatabase

module

module:debug Displaycurrentmodulesavailableforapplication

module:download Downloadmoduleormodulesinapplication

module:install Installmoduleormodulesintheapplication

module:uninstall Uninstallmoduleormodulesintheapplication

multisite

multisite:debug Listallmultisitesavailableinsystem

rest

rest:debug Displaycurrentrestresourcefortheapplication

rest:disable Disablearestresourcefortheapplication

rest:enable Enablearestresourcefortheapplication

router

DrupalConsole

26Availablecommands

Page 27: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

router:debug Displayscurrentroutesfortheapplication

router:rebuild Rebuildroutesfortheapplication

site

site:debug Listallknownlocalandremotesites.

site:install InstallaDrupalproject

site:maintenance Switchsiteintomaintenancemode

site:mode Switchsystemperformanceconfiguration

site:new CreateanewDrupalproject

site:status ViewcurrentDrupalInstallationstatus

test

test:debug ListTestUnitsavailablefortheapplication.

test:run RunTestunitfromtestsavailableforapplication

theme

theme:debug Displayscurrentthemesfortheapplication

theme:download Installthemeorthemesintheapplication

theme:install Installthemeorthemesintheapplication

theme:uninstall Uninstallthemeorthemesintheapplication

update

update:debug Displaycurrentupdatesavailablefortheapplication

update:execute ExecuteaspecificUpdateNfunctioninamodule,orexecuteall

user

user:login:clear:attempts Clearloginfailedattemptsforanaccount.

user:login:url Returnsaone-timeuserloginurl.

user:password:hash Generateahashfromaplaintextpassword.

user:password:reset Resetpasswordforaspecificuser.

views

views:debug Displaycurrentviewsresourcesfortheapplication

views:disable DisableaView

views:enable EnableaView

yaml

ComparetwoYAMLfilesinordertofinddifferences

DrupalConsole

27Availablecommands

Page 28: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

betweenthem.

yaml:merge MergeoneormoreYAMLfilesinanewYAMLfile.Latestvaluesarepreserved.

yaml:split SplitaYAMLfileusingindentasseparatorcriteria

yaml:update:key ReplaceaYAMLkeyinaYAMLfile.

yaml:update:value UpdateavalueforaspecifickeyinaYAMLfile.

Availableoptions

Option Details

--help Displaythishelpmessage

--quiet Donotoutputanymessage

--verbose Increasetheverbosityofmessages:1fornormaloutput,2formoreverboseoutputand3fordebug

--version Displaythisapplicationversion

--ansi ForceANSIoutput

--no-ansi DisableANSIoutput

--no-interaction Donotaskanyinteractivequestion

--root DefinetheDrupalroottobeuseincommandexecution

--shell Launchtheshell.

--env TheEnvironmentname.

--no-debug Switchesoffdebugmode.

--learning Generateaverbosecodeoutput.

--generate-chain

Printexecutionoptionsandargumentsasyamloutputtobeusedinchaincommand

--generate-inline

Printexecutionoptionsandargumentsasinlinecalltobeuseinthefuture

--generate-doc application.console.arguments.generate-doc

--target application.console.arguments.target

--uri URIoftheDrupalsitetouse(formultisiteenvironmentsorwhenrunningonanalternateport)

DrupalConsole

28Availablecommands

Page 29: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

Availablearguments

Argument Details

command Thecommandtoexecute

DrupalConsole

29Availablecommands

Page 30: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

aboutTheaboutcommandDisplaybasicinformationaboutDrupalConsoleproject

Usage:

$drupalabout

DrupalConsole

30about

Page 31: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

chainThechaincommandChaincommandexecution

Usage:

$drupalchain[options]

Availableoptions

Option Details

--file Userdefinedfilecontainingcommandstogetexecuted.

DrupalConsole

31chain

Page 32: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

drushThedrushcommandRundrushfromconsole.

Usage:

$drupaldrush[arguments]

Availablearguments

Argument Details

args Drusharguments.

DrupalConsole

32drush

Page 33: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

helpThehelpcommandDisplayshelpforacommand

Usage:

$drupalhelp[arguments][options]

Availableoptions

Option Details

--xml TooutputhelpasXML

--format Theoutputformat(txt,xml,json,ormd)

--raw Tooutputrawcommandhelp

Availablearguments

Argument Details

command_name Thecommandname

DrupalConsole

33help

Page 34: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

initTheinitcommandCopyconfigurationfilestouserhomedirectory.

Usage:

$drupalinit[options]

Availableoptions

Option Details

--override Overrideconfigurationsfiles

DrupalConsole

34init

Page 35: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

listThelistcommandListscommands22

Usage:

$drupallist[arguments][options]

Availableoptions

Option Details

--xml TooutputlistasXML

--raw Tooutputrawcommandlist

--format Theoutputformat(txt,xml,json,ormd)

Availablearguments

Argument Details

namespace Thenamespacename

DrupalConsole

35list

Page 36: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

self-updateTheself-updatecommandUpdatetheconsoletolatestversion.

Usage:

$drupalself-update

DrupalConsole

36self-update

Page 37: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

serverTheservercommandRunsPHPbuilt-inwebserver

Usage:

$drupalserver[arguments]

Availablearguments

Argument Details

address Theaddress:portvalues

ExamplesRunusingdefaultaddressargumentvalue127.0.0.1.8088

$drupalserver

Passingaddressargumenttouseadifferentportnumber

$drupalserver127.0.0.1:8089

Runningdefaultaddressargumentvalues,using--rootoptiontodefinetheDrupalroot

$drupal--root=/var/www/drupal8.devserver

DrupalConsole

37server

Page 38: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

cache:rebuildThecache:rebuildcommandRebuildandclearallsitecaches.

Usage:

$drupalcache:rebuild[arguments]

Availablearguments

Argument Details

cache Onlyclearaspecificcache.

ExamplesRebuildallcaches

$drupalcrall

Rebuilddiscoverycache

$drupalcrdiscovery

DrupalConsole

38cache:rebuild

Page 39: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

config:debugTheconfig:debugcommandShowthecurrentconfiguration.

Usage:

$drupalconfig:debug[arguments]

Availablearguments

Argument Details

config-name Configurationname.

DrupalConsole

39config:debug

Page 40: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

config:editTheconfig:editcommandEdittheselectedconfiguration.

Usage:

$drupalconfig:edit[arguments]

Availablearguments

Argument Details

config-name Configurationname.

editor Editor.

DrupalConsole

40config:edit

Page 41: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

config:exportTheconfig:exportcommandExportcurrentapplicationconfiguration.

Usage:

$drupalconfig:export[options]

Availableoptions

Option Details

--directory commands.config.export.options.directory

--tar commands.config.export.options.tar

DrupalConsole

41config:export

Page 42: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

config:export:content:typeTheconfig:export:content:typecommandExportaspecificcontenttypeandtheirfields.

Usage:

$drupalconfig:export:content:type[arguments][options]

Availableoptions

Option Details

--module TheModulename.

--optional-config

ExportcontenttypeasanoptionalYAMLconfigurationinyourmodule

Availablearguments

Argument Details

content_type ContentTypetobeexported

DrupalConsole

42config:export:content:type

Page 43: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

config:export:singleTheconfig:export:singlecommandExportsingleconfigurationasymlfile.

Usage:

$drupalconfig:export:single[arguments]

Availablearguments

Argument Details

config-name Configurationname.

directory Defineexportdirectorytosaveconfigurationoutput.

DrupalConsole

43config:export:single

Page 44: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

config:export:viewTheconfig:export:viewcommandcommands.config.export.view.description

Usage:

$drupalconfig:export:view[arguments][options]

Availableoptions

Option Details

--module TheModulename.

--optional-config commands.config.export.view.options.optional-config

--include-module-dependencies

commands.config.export.view.options.include-module-dependencies

Availablearguments

Argument Details

view-id commands.config.export.view.arguments.view-id

DrupalConsole

44config:export:view

Page 45: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

config:importTheconfig:importcommandImportconfigurationtocurrentapplication.

Usage:

$drupalconfig:import[options]

Availableoptions

Option Details

--file commands.config.import.option.file

--remove-files commands.config.import.option.keep-files

DrupalConsole

45config:import

Page 46: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

config:import:singleTheconfig:import:singlecommandImporttheselectedconfiguration.

Usage:

$drupalconfig:import:single[arguments]

Availablearguments

Argument Details

config-name Configurationname.

input-file Pathtotheimportfiles.

DrupalConsole

46config:import:single

Page 47: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

config:overrideTheconfig:overridecommandOverrideconfigvalueinactiveconfiguration.

Usage:

$drupalconfig:override[arguments]

Availablearguments

Argument Details

config-name Configurationname.

key Key

value Value

DrupalConsole

47config:override

Page 48: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

container:debugThecontainer:debugcommandDisplayscurrentservicesforanapplication.

Usage:

$drupalcontainer:debug

DrupalConsole

48container:debug

Page 49: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

cron:debugThecron:debugcommandListofmodulesimplementingacron

Usage:

$drupalcron:debug

DrupalConsole

49cron:debug

Page 50: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

cron:executeThecron:executecommandExecutecronimplementationsbymoduleorexecuteallcrons

Usage:

$drupalcron:execute[arguments]

Availablearguments

Argument Details

module TheModulename.

DrupalConsole

50cron:execute

Page 51: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

cron:releaseThecron:releasecommandReleasecronsystemlocktoruncronagain

Usage:

$drupalcron:release

DrupalConsole

51cron:release

Page 52: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

database:clientThedatabase:clientcommandLaunchaDBclientifit'savailable

Usage:

$drupaldatabase:client[arguments]

Availablearguments

Argument Details

database Databasekeyfromsettings.php

DrupalConsole

52database:client

Page 53: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

database:connectThedatabase:connectcommandLaunchaDBclientifit'savailable

Usage:

$drupaldatabase:connect[arguments]

Availablearguments

Argument Details

database Databasekeyfromsettings.php

DrupalConsole

53database:connect

Page 54: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

database:dumpThedatabase:dumpcommandDumpstructureandcontentsofMySQLdatabasesandtables

Usage:

$drupaldatabase:dump[arguments][options]

Availableoptions

Option Details

--file commands.database.dump.option.file

Availablearguments

Argument Details

database Databasekeyfromsettings.php

DrupalConsole

54database:dump

Page 55: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

database:log:clearThedatabase:log:clearcommandRemoveeventsfromDBLogtable,filtersareavailable

Usage:

$drupaldatabase:log:clear[arguments][options]

Availableoptions

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

Availablearguments

Argument Details

event-id commands.database.log.clear.arguments.event-id

DrupalConsole

55database:log:clear

Page 56: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

database:log:debugThedatabase:log:debugcommandDisplaycurrentlogeventsfortheapplication

Usage:

$drupaldatabase:log:debug[arguments][options]

Availableoptions

Option Details

--type Filtereventsbyaspecifictype

--severity Filtereventsbyaspecificlevelofseverity

--user-id Filtereventsbyaspecificuserid

--limit Limitresultstoaspecificnumber

--offset Startingpointofalimit

Availablearguments

Argument Details

event-id DBLogeventID

DrupalConsole

56database:log:debug

Page 57: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

database:restoreThedatabase:restorecommandRestorestructureandcontentsofMySQLdatabasesandtables

Usage:

$drupaldatabase:restore[arguments][options]

Availableoptions

Option Details

--file Thefilenameforyourdatabasebackupfile

Availablearguments

Argument Details

database Databasekeyfromsettings.php

DrupalConsole

57database:restore

Page 58: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

generate:authentication:providerThegenerate:authentication:providercommandGenerateanAuthenticationProvider

Usage:

$drupalgenerate:authentication:provider[options]

Availableoptions

Option Details

--module TheModulename.

--class AuthenticationProviderclass

--provider-id ProviderID

DrupalConsole

58generate:authentication:provider

Page 59: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

generate:commandThegenerate:commandcommandGeneratecommandsfortheconsole.

Usage:

$drupalgenerate:command[options]

Availableoptions

Option Details

--module TheModulename.

--class TheClassthatdescribesthecommand.(Mustendwiththeword'Commmand').

--name TheCommandname.

--container-aware Isthecommandawareofthedrupalsiteinstallationwhenexecuted

DrupalConsole

59generate:command

Page 60: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

generate:controllerThegenerate:controllercommandGenerate&Registeracontroller

Usage:

$drupalgenerate:controller[options]

Availableoptions

Option Details

--module TheModulename.

--class-name ControllerClassname

--controller-title Titleofthecontroller

--method-name Theactionmethodname

--route Theroutepath

--services Loadservicesfromthecontainer.

--test Generateatestclass

DrupalConsole

60generate:controller

Page 61: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

generate:doc:dashThegenerate:doc:dashcommandGeneratetheDrupalConsole.docsetpackageforDash

Usage:

$drupalgenerate:doc:dash[options]

Availableoptions

Option Details

--path Thepathtothedirectorywherethedocsetwillbesaved.

DrupalConsole

61generate:doc:dash

Page 62: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

generate:doc:gitbookThegenerate:doc:gitbookcommandGeneratedocumentationsforCommands

Usage:

$drupalgenerate:doc:gitbook[arguments][options]

Availableoptions

DrupalConsole

62generate:doc:gitbook

Page 63: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

Option Details

--path Thepathtorenderthedocumentation

--help Displaythishelpmessage

--quiet Donotoutputanymessage

--verbose Increasetheverbosityofmessages:1fornormaloutput,2formoreverboseoutputand3fordebug

--version Displaythisapplicationversion

--ansi ForceANSIoutput

--no-ansi DisableANSIoutput

--no-interaction Donotaskanyinteractivequestion

--root DefinetheDrupalroottobeuseincommandexecution

--shell Launchtheshell.

--env TheEnvironmentname.

--no-debug Switchesoffdebugmode.

--learning Generateaverbosecodeoutput.

--generate-chain

Printexecutionoptionsandargumentsasyamloutputtobeusedinchaincommand

--generate-inline

Printexecutionoptionsandargumentsasinlinecalltobeuseinthefuture

--generate-doc application.console.arguments.generate-doc

--target application.console.arguments.target

--uri URIoftheDrupalsitetouse(formultisiteenvironmentsorwhenrunningonanalternateport)

Availablearguments

Argument Details

command Thecommandtoexecute

DrupalConsole

63generate:doc:gitbook

Page 64: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

generate:entity:bundleThegenerate:entity:bundlecommandGenerateanewcontenttype(node/entitybundle)

Usage:

$drupalgenerate:entity:bundle[options]

Availableoptions

Option Details

--module TheModulename.

--bundle-name Thecontenttype'smachinename

--bundle-title Thecontenttype'shuman-readablename

DrupalConsole

64generate:entity:bundle

Page 65: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

generate:entity:configThegenerate:entity:configcommandGenerateanewconfigentity

Usage:

$drupalgenerate:entity:config[options]

Availableoptions

Option Details

--module TheModulename.

--entity-class Theconfigentityclass

--entity-name Theconfigentityname

--label Thelabel

DrupalConsole

65generate:entity:config

Page 66: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

generate:entity:contentThegenerate:entity:contentcommandGenerateanewcontententity

Usage:

$drupalgenerate:entity:content[options]

Availableoptions

Option Details

--module TheModulename.

--entity-class Thecontententityclass

--entity-name Thecontententityname

--label Thelabel

DrupalConsole

66generate:entity:content

Page 67: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

generate:event:subscriberThegenerate:event:subscribercommandGenerateaneventsubscriber

Usage:

$drupalgenerate:event:subscriber[options]

Availableoptions

Option Details

--module TheModulename.

--name commands.generate.service.options.name

--class commands.generate.service.options.class

--events Loadservicesfromthecontainer.

--services Loadservicesfromthecontainer.

DrupalConsole

67generate:event:subscriber

Page 68: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

generate:formThegenerate:formcommandGenerateanew"FormBase"

Usage:

$drupalgenerate:form[options]

Availableoptions

Option Details

--module TheModulename.

--class-name Theformclassname

--form-id TheFormid

--services Loadservicesfromthecontainer.

--inputs Createinputsinaform.

--routing Updaterouting

DrupalConsole

68generate:form

Page 69: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

generate:form:alterThegenerate:form:altercommandGenerateanimplementationofhook_form_alter()orhook_form_FORM_ID_alter

Usage:

$drupalgenerate:form:alter[options]

Availableoptions

Option Details

--module TheModulename.

--form-id FormIDtoalter

--inputs Createinputsinaform.

DrupalConsole

69generate:form:alter

Page 70: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

generate:form:configThegenerate:form:configcommandGenerateanew"ConfigFormBase"

Usage:

$drupalgenerate:form:config[options]

Availableoptions

Option Details

--module TheModulename.

--class-name Theformclassname

--form-id TheFormid

--services Loadservicesfromthecontainer.

--inputs Createinputsinaform.

--routing Updaterouting

DrupalConsole

70generate:form:config

Page 71: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

generate:moduleThegenerate:modulecommandGenerateamodule.

Usage:

$drupalgenerate:module[options]

Availableoptions

Option Details

--module TheModulename

--machine-name Themachinename(lowercaseandunderscoreonly)

--module-path Thepathofthemodule

--description Moduledescription

--core Coreversion

--package Modulepackage

--feature SetmodulecompatiblewithFeaturesmodule

--composer Addacomposer.jsonfile

--dependencies Moduledependenciesseparatedbycommas(i.e.context,panels)

DrupalConsole

71generate:module

Page 72: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

generate:permissionsThegenerate:permissionscommandGeneratemodulepermissions

Usage:

$drupalgenerate:permissions[options]

Availableoptions

Option Details

--module TheModulename.

--permissions Createpermissions.

DrupalConsole

72generate:permissions

Page 73: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

generate:plugin:blockThegenerate:plugin:blockcommandGenerateapluginblock

Usage:

$drupalgenerate:plugin:block[options]

Availableoptions

Option Details

--module TheModulename.

--class-name Pluginclassname

--label Pluginlabel

--plugin-id Pluginid

--theme-region ThemeregiontorenderPluginBlock

--inputs Createinputsinaform.

--services Loadservicesfromthecontainer.

DrupalConsole

73generate:plugin:block

Page 74: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

generate:plugin:conditionThegenerate:plugin:conditioncommandGenerateaplugincondition.

Usage:

$drupalgenerate:plugin:condition[options]

Availableoptions

Option Details

--module TheModulename.

--class-name Pluginconditionclassname

--label Pluginconditionlabel

--plugin-id Pluginconditionid

--context-definition-id ContextdefinitionID

--context-definition-label Contextdefinitionlabel

--context-definition-required Contextdefinitionisrequiered(TRUE/FALSE)

DrupalConsole

74generate:plugin:condition

Page 75: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

generate:plugin:fieldThegenerate:plugin:fieldcommandGeneratefieldtype,widgetandformatterplugins.

Usage:

$drupalgenerate:plugin:field[options]

Availableoptions

Option Details

--module TheModulename.

--type-class-name Fieldtypepluginclassname

--type-label Fieldtypepluginlabel

--type-plugin-id Fieldtypepluginid

--type-description commands.generate.plugin.field.options.type-type-description

--formatter-class-name commands.generate.plugin.field.options.class-name

--formatter-label Fieldformatterpluginlabel

--formatter-plugin-id Fieldformatterpluginid

--widget-class-name Fieldformatterpluginclassname

--widget-label Fieldwidgetpluginlabel

--widget-plugin-id Fieldwidgetpluginid

--field-type Fieldtypetheformatterandwidgetplugincanbeusedwith

--default-widget Defaultfieldwidgetofthefieldtypeplugin

--default-formatter Defaultfieldformatteroffieldtypeplugin

DrupalConsole

75generate:plugin:field

Page 76: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

generate:plugin:fieldformatterThegenerate:plugin:fieldformattercommandGeneratefieldformatterplugin.

Usage:

$drupalgenerate:plugin:fieldformatter[options]

Availableoptions

Option Details

--module TheModulename.

--class-name Pluginclassname

--label Pluginlabel

--plugin-id Pluginid

--field-type Fieldtypetheplugincanbeusedwith

DrupalConsole

76generate:plugin:fieldformatter

Page 77: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

generate:plugin:fieldtypeThegenerate:plugin:fieldtypecommandGeneratefieldtypeplugin.

Usage:

$drupalgenerate:plugin:fieldtype[options]

Availableoptions

Option Details

--module TheModulename.

--class-name Pluginclassname

--label Pluginlabel

--plugin-id Pluginid

--description PluginDescription

--default-widget Defaultfieldwidgetofthisplugin

--default-formatter Defaultfieldformatterofthisplugin

DrupalConsole

77generate:plugin:fieldtype

Page 78: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

generate:plugin:fieldwidgetThegenerate:plugin:fieldwidgetcommandGeneratefieldwidgetplugin.

Usage:

$drupalgenerate:plugin:fieldwidget[options]

Availableoptions

Option Details

--module TheModulename.

--class-name Pluginclassname

--label Pluginlabel

--plugin-id Pluginid

--field-type Fieldtypetheplugincanbeusedwith

DrupalConsole

78generate:plugin:fieldwidget

Page 79: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

generate:plugin:imageeffectThegenerate:plugin:imageeffectcommandGenerateimageeffectplugin.

Usage:

$drupalgenerate:plugin:imageeffect[options]

Availableoptions

Option Details

--module TheModulename.

--class-name Pluginclassname

--label Pluginlabel

--plugin-id Pluginid

--description PluginDescription

DrupalConsole

79generate:plugin:imageeffect

Page 80: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

generate:plugin:imageformatterThegenerate:plugin:imageformattercommandGenerateimageformatterplugin.

Usage:

$drupalgenerate:plugin:imageformatter[options]

Availableoptions

Option Details

--module TheModulename.

--class-name Pluginclassname

--label Pluginlabel

--plugin-id Pluginid

DrupalConsole

80generate:plugin:imageformatter

Page 81: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

generate:plugin:rest:resourceThegenerate:plugin:rest:resourcecommandGeneratepluginrestresource

Usage:

$drupalgenerate:plugin:rest:resource[options]

Availableoptions

Option Details

--module TheModulename.

--class-name PluginRestResourceclass

--name commands.generate.service.options.name

--plugin-id PluginRestResourceid

--plugin-label PluginRestResourceLabel

--plugin-url PluginRestResourceURL

--plugin-states PluginRestResourceStates

DrupalConsole

81generate:plugin:rest:resource

Page 82: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

generate:plugin:rulesactionThegenerate:plugin:rulesactioncommandGenerateapluginruleaction

Usage:

$drupalgenerate:plugin:rulesaction[options]

Availableoptions

Option Details

--module TheModulename.

--class-name Pluginclassname

--label Pluginlabel

--plugin-id Pluginid

--type ActionType(userornode)

--category Plugincategory

--context Plugincontext

DrupalConsole

82generate:plugin:rulesaction

Page 83: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

generate:plugin:type:annotationThegenerate:plugin:type:annotationcommandGenerateaplugintypewithannotationdiscovery

Usage:

$drupalgenerate:plugin:type:annotation[options]

Availableoptions

Option Details

--module TheModulename.

--class-name Plugintypeclassname

--machine-name commands.generate.plugin.type.annotation.options.plugin-id

--label Plugintypelabel

DrupalConsole

83generate:plugin:type:annotation

Page 84: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

generate:plugin:type:yamlThegenerate:plugin:type:yamlcommandGenerateaplugintypewithYamldiscovery

Usage:

$drupalgenerate:plugin:type:yaml[options]

Availableoptions

Option Details

--module TheModulename.

--class-name Plugintypeclassname

--plugin-name Plugintypemachinename

--plugin-file-name Pluginfilename

DrupalConsole

84generate:plugin:type:yaml

Page 85: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

generate:plugin:views:fieldThegenerate:plugin:views:fieldcommandGenerateacustompluginviewfield.

Usage:

$drupalgenerate:plugin:views:field[options]

Availableoptions

Option Details

--module TheModulename.

--class-name Viewspluginfieldclassname

--title Viewspluginfieldtitle

--description Viewspluginfielddescription

DrupalConsole

85generate:plugin:views:field

Page 86: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

generate:routesubscriberThegenerate:routesubscribercommandGenerateaRouteSubscriber

Usage:

$drupalgenerate:routesubscriber[options]

Availableoptions

Option Details

--module TheModulename.

--name Servicename

--class Classname

DrupalConsole

86generate:routesubscriber

Page 87: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

generate:serviceThegenerate:servicecommandGenerateservice

Usage:

$drupalgenerate:service[options]

Availableoptions

Option Details

--module TheModulename.

--name commands.generate.service.options.name

--class commands.generate.service.options.class

--interface commands.common.service.options.interface

--services Loadservicesfromthecontainer.

DrupalConsole

87generate:service

Page 88: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

generate:themeThegenerate:themecommandGenerateatheme.

Usage:

$drupalgenerate:theme[options]

Availableoptions

Option Details

--theme commands.generate.theme.options.module

--machine-name Themachinename(lowercaseandunderscoreonly)

--theme-path commands.generate.theme.options.module-path

--description Themedescription

--core Coreversion

--package Themepackage

--global-library Globalstylinglibraryname

--base-theme Basetheme(i.e.classy,seven)

--regions Regions

--breakpoints Breakpoints

DrupalConsole

88generate:theme

Page 89: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

locale:language:addThelocale:language:addcommandAddalanguagetobesupportedbyyoursite

Usage:

$drupallocale:language:add[arguments]

Availablearguments

Argument Details

language LanguageforinstanceesorSpanish

DrupalConsole

89locale:language:add

Page 90: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

locale:language:deleteThelocale:language:deletecommandDeletealanguagetobesupportedbyyoursite

Usage:

$drupallocale:language:delete[arguments]

Availablearguments

Argument Details

language LanguageforinstanceesorSpanish

DrupalConsole

90locale:language:delete

Page 91: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

locale:translation:statusThelocale:translation:statuscommandListavailabletranslationupdates

Usage:

$drupallocale:translation:status[arguments]

Availablearguments

Argument Details

language LanguageforinstanceesorSpanish

DrupalConsole

91locale:translation:status

Page 92: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

migrate:debugThemigrate:debugcommandDisplaycurrentmigrationavailablefortheapplication

Usage:

$drupalmigrate:debug[arguments]

Availablearguments

Argument Details

tag Migratetag

DrupalConsole

92migrate:debug

Page 93: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

migrate:executeThemigrate:executecommandExecuteamigrationavailableforapplication

Usage:

$drupalmigrate:execute[arguments][options]

Availableoptions

Option Details

--site-url SiteSourceURL

--db-type commands.migrate.setup.migrations.options.db-type

--db-host DatabaseHost

--db-name DatabaseName

--db-user DatabaseUser

--db-pass DatabasePass

--db-prefix DatabasePrefix

--db-port DatabasePort

--exclude Migrationid(s)toexclude

Availablearguments

Argument Details

migration-ids Migrationid(s)

DrupalConsole

93migrate:execute

Page 94: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

migrate:setupThemigrate:setupcommandLoadandcreatetherelevantmigrationsforaprovidedlegacydatabase

Usage:

$drupalmigrate:setup[options]

Availableoptions

Option Details

--db-type DrupalDatabasetype

--db-host DatabaseHost

--db-name DatabaseName

--db-user DatabaseUser

--db-pass DatabasePass

--db-prefix DatabasePrefix

--db-port DatabasePort

DrupalConsole

94migrate:setup

Page 95: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

module:debugThemodule:debugcommandDisplaycurrentmodulesavailableforapplication

Usage:

$drupalmodule:debug[options]

Availableoptions

Option Details

--status Modulestatus[enabled disabled]

--type Moduletype[core no-core]

DrupalConsole

95module:debug

Page 96: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

module:downloadThemodule:downloadcommandDownloadmoduleormodulesinapplication

Usage:

$drupalmodule:download[arguments]

Availablearguments

Argument Details

module commands.module.download.options.module

version Moduleversioni.e1.x-dev

DrupalConsole

96module:download

Page 97: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

module:installThemodule:installcommandInstallmoduleormodulesintheapplication

Usage:

$drupalmodule:install[arguments][options]

Availableoptions

Option Details

--overwrite-config Overwriteconfigurationactiveifnecessary

Availablearguments

Argument Details

module Moduleormodulestobeenabledshouldbeseparatedbyacomma

DrupalConsole

97module:install

Page 98: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

module:uninstallThemodule:uninstallcommandUninstallmoduleormodulesintheapplication

Usage:

$drupalmodule:uninstall[arguments]

Availablearguments

Argument Details

module Moduleormodulestobeuninstalledshouldbeseparatedbyacomma

DrupalConsole

98module:uninstall

Page 99: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

multisite:debugThemultisite:debugcommandListallmultisitesavailableinsystem

Usage:

$drupalmultisite:debug

DrupalConsole

99multisite:debug

Page 100: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

rest:debugTherest:debugcommandDisplaycurrentrestresourcefortheapplication

Usage:

$drupalrest:debug[arguments][options]

Availableoptions

Option Details

--authorization Restresourcestatusenabled disabled

Availablearguments

Argument Details

resource-id RestID

DrupalConsole

100rest:debug

Page 101: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

rest:disableTherest:disablecommandDisablearestresourcefortheapplication

Usage:

$drupalrest:disable[arguments]

Availablearguments

Argument Details

resource-id RestID

DrupalConsole

101rest:disable

Page 102: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

rest:enableTherest:enablecommandEnablearestresourcefortheapplication

Usage:

$drupalrest:enable[arguments]

Availablearguments

Argument Details

resource-id RestID

DrupalConsole

102rest:enable

Page 103: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

router:debugTherouter:debugcommandDisplayscurrentroutesfortheapplication

Usage:

$drupalrouter:debug[arguments]

Availablearguments

Argument Details

route-name Routenames

DrupalConsole

103router:debug

Page 104: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

router:rebuildTherouter:rebuildcommandRebuildroutesfortheapplication

Usage:

$drupalrouter:rebuild

DrupalConsole

104router:rebuild

Page 105: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

site:debugThesite:debugcommandListallknownlocalandremotesites.

Usage:

$drupalsite:debug[arguments]

Availablearguments

Argument Details

target commands.site.debug.options.target

DrupalConsole

105site:debug

Page 106: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

site:installThesite:installcommandInstallaDrupalproject

Usage:

$drupalsite:install[arguments][options]

Availableoptions

Option Details

--langcode Drupallanguage

--db-type DrupalDatabasetypetobeuseininstall

--db-file DrupalDatabasefiletobeuseininstall

--db-host DatabaseHost

--db-name DatabaseName

--db-user DatabaseUser

--db-pass DatabasePass

--db-prefix DatabasePrefix

--db-port DatabasePort

--site-name Drupalsitename

--site-mail Drupalsitemail

--account-name Drupaladministratoraccountname

--account-mail Drupaladministratoraccountmail

--account-pass Drupaladministratoraccountpassword

Availablearguments

Argument Details

profile DrupalProfiletobeinstall

DrupalConsole

106site:install

Page 107: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

site:maintenanceThesite:maintenancecommandSwitchsiteintomaintenancemode

Usage:

$drupalsite:maintenance[arguments]

Availablearguments

Argument Details

mode Sitemaintenancemode[on/off]

DrupalConsole

107site:maintenance

Page 108: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

site:modeThesite:modecommandSwitchsystemperformanceconfiguration

Usage:

$drupalsite:mode[arguments]

Availablearguments

Argument Details

environment Environmentname[dev,prod]

DrupalConsole

108site:mode

Page 109: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

site:newThesite:newcommandCreateanewDrupalproject

Usage:

$drupalsite:new[arguments]

Availablearguments

Argument Details

site-name Sitename

version SpecificDrupalversiontodownload

DrupalConsole

109site:new

Page 110: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

site:statusThesite:statuscommandViewcurrentDrupalInstallationstatus

Usage:

$drupalsite:status[options]

Availableoptions

Option Details

--format commands.site.status.options.format

DrupalConsole

110site:status

Page 111: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

test:debugThetest:debugcommandListTestUnitsavailablefortheapplication.

Usage:

$drupaltest:debug[arguments][options]

Availableoptions

Option Details

--group Group

Availablearguments

Argument Details

test-class TestClass

DrupalConsole

111test:debug

Page 112: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

test:runThetest:runcommandRunTestunitfromtestsavailableforapplication

Usage:

$drupaltest:run[arguments][options]

Availableoptions

Option Details

--url commands.test.run.arguments.url

Availablearguments

Argument Details

test-class TestClass

DrupalConsole

112test:run

Page 113: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

theme:debugThetheme:debugcommandDisplayscurrentthemesfortheapplication

Usage:

$drupaltheme:debug[arguments]

Availablearguments

Argument Details

theme Specificthemetodebug

DrupalConsole

113theme:debug

Page 114: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

theme:downloadThetheme:downloadcommandInstallthemeorthemesintheapplication

Usage:

$drupaltheme:download[arguments]

Availablearguments

Argument Details

theme themeorthemestobeinstalledshouldbeseparatedbyacomma

version Themeversioni.e1.x-dev

DrupalConsole

114theme:download

Page 115: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

theme:installThetheme:installcommandInstallthemeorthemesintheapplication

Usage:

$drupaltheme:install[arguments][options]

Availableoptions

Option Details

--set-default Setthemeasdefaulttheme

Availablearguments

Argument Details

theme commands.theme.install.options.module

DrupalConsole

115theme:install

Page 116: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

theme:uninstallThetheme:uninstallcommandUninstallthemeorthemesintheapplication

Usage:

$drupaltheme:uninstall[arguments]

Availablearguments

Argument Details

theme commands.theme.uninstall.options.module

DrupalConsole

116theme:uninstall

Page 117: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

update:debugTheupdate:debugcommandDisplaycurrentupdatesavailablefortheapplication

Usage:

$drupalupdate:debug

DrupalConsole

117update:debug

Page 118: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

update:executeTheupdate:executecommandExecuteaspecificUpdateNfunctioninamodule,orexecuteall

Usage:

$drupalupdate:execute[arguments]

Availablearguments

Argument Details

module TheModulename.

update-n SpecificUpdateNfunctiontobeexecuted

DrupalConsole

118update:execute

Page 119: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

user:login:clear:attemptsTheuser:login:clear:attemptscommandClearloginfailedattemptsforanaccount.

Usage:

$drupaluser:login:clear:attempts[arguments]

Availablearguments

Argument Details

uid UserID.

DrupalConsole

119user:login:clear:attempts

Page 120: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

user:login:urlTheuser:login:urlcommandReturnsaone-timeuserloginurl.

Usage:

$drupaluser:login:url[arguments]

Availablearguments

Argument Details

user-id UserID.

DrupalConsole

120user:login:url

Page 121: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

user:password:hashTheuser:password:hashcommandGenerateahashfromaplaintextpassword.

Usage:

$drupaluser:password:hash[arguments]

Availablearguments

Argument Details

password Password(s)intextformat

DrupalConsole

121user:password:hash

Page 122: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

user:password:resetTheuser:password:resetcommandResetpasswordforaspecificuser.

Usage:

$drupaluser:password:reset[arguments]

Availablearguments

Argument Details

user UserID

password Passwordintextformat

DrupalConsole

122user:password:reset

Page 123: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

views:debugTheviews:debugcommandDisplaycurrentviewsresourcesfortheapplication

Usage:

$drupalviews:debug[arguments][options]

Availableoptions

Option Details

--tag Viewtag

--status Viewstatus(Enabled Disabled)

Availablearguments

Argument Details

view-id ViewID

DrupalConsole

123views:debug

Page 124: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

views:disableTheviews:disablecommandDisableaView

Usage:

$drupalviews:disable[arguments]

Availablearguments

Argument Details

view-id ViewID

DrupalConsole

124views:disable

Page 125: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

views:enableTheviews:enablecommandEnableaView

Usage:

$drupalviews:enable[arguments]

Availablearguments

Argument Details

view-id ViewID

DrupalConsole

125views:enable

Page 126: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

yaml:diffTheyaml:diffcommandComparetwoYAMLfilesinordertofinddifferencesbetweenthem.

Usage:

$drupalyaml:diff[arguments][options]

Availableoptions

Option Details

--stats PrintstatisticsaboutYAMLfilescomparation

--negate Definemodedifforequalcomparation,possiblevaluesTRUE/FALSEor0/1

--limit Limitresultstoaspecificnumber

--offset Startingpointofalimit

Availablearguments

Argument Details

yaml-left YAMLfileusedasbasetocompare

yaml-right YAMLfileusedtofindmissingpartsordifferenceswiththebaseYAMLfile

DrupalConsole

126yaml:diff

Page 127: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

yaml:mergeTheyaml:mergecommandMergeoneormoreYAMLfilesinanewYAMLfile.Latestvaluesarepreserved.

Usage:

$drupalyaml:merge[arguments]

Availablearguments

Argument Details

yaml-destination PathofnewYAMLfiletostoretheresultofmerge.

yaml-files PathofYAMLfilestomerge

DrupalConsole

127yaml:merge

Page 128: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

yaml:splitTheyaml:splitcommandSplitaYAMLfileusingindentasseparatorcriteria

Usage:

$drupalyaml:split[arguments][options]

Availableoptions

Option Details

--indent-level SplitYAMLfileusingaspecificindentlevel

--file-output-prefix commands.yaml.split.options.file-output-prefix

--file-output-suffix commands.yaml.split.options.file-output-suffix

--starting-key YAMLKeyfromwherestartsplitusefultoextractpartialelements

--exclude-parents-key Excludeparentskeyinfilenamegenerated

Availablearguments

Argument Details

yaml-file commands.yaml.split.value.arguments.yaml-file

DrupalConsole

128yaml:split

Page 129: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

yaml:update:keyTheyaml:update:keycommandReplaceaYAMLkeyinaYAMLfile.

Usage:

$drupalyaml:update:key[arguments]

Availablearguments

Argument Details

yaml-file PathofYAMLfiletoupdate

yaml-key YAMLkeytoupdate

yaml-new-key commands.yaml.update.value.arguments.yaml-new-key

DrupalConsole

129yaml:update:key

Page 130: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

yaml:update:valueTheyaml:update:valuecommandUpdateavalueforaspecifickeyinaYAMLfile.

Usage:

$drupalyaml:update:value[arguments]

Availablearguments

Argument Details

yaml-file PathofYAMLfiletoupdate

yaml-key YAMLkeytoupdate

yaml-value YAMLvaluetoupdate

DrupalConsole

130yaml:update:value

Page 131: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

ContributingnewfeaturesIfyoucreateanewcustomcommandorsomethingelsewhichwouldbeusefulforotherDrupalinstallations,pleaseconsiderforkingtheDrupalConsoleprojectonGitHub.Thenjustcreateanissuefora"featurerequest",putyourworkinanewGitbranchonyourfork,publishyourbranchandaddapullrequestonGitHub(includingyourissueIDinthePRtitle).TheDrupalConsolemaintainersareveryhappytoacceptusefulcontributionsandusuallydosoquitepromptly.

GettingsupportwithbecomingacontributorIfyouwanttocontributetoDrupalConsoleandhaveanydifficultygettingorientedtotheprocess,youcanfindInstantMessagingsupportonGitterIM.

StandardGitHubWorkflowIfyouhaven'tyetcontributedtoaprojectonGitHub,orarenotsureyouremembertheworkflow,youmightfirstwanttoreadthedocumentationaboutpullrequests.YoumayalsowishtodownloadtheGitHubapplication(Mac|Windows,whichsimplifiestheworkflowabitandprovidesaniceGUIforyourcontributions).

Github-flavoredMarkdownThisdocumentationiswrittenin“Github-flavoredMarkdown”,whichisrenderedonGithub,directly,asHTML.IfyouarealreadyfamiliarwithMarkdown,GFLonlyaddsafewusefultweaks,otherwiseyoumaywanttoreadGithub’sMarkdownBasicsprimer.

DrupalConsole

131ContributingtoDrupalConsole

Page 132: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

Projectrequirements

DownloadGitWerecommenddownloadingGitfromhttp://git-scm.com/downloads

DownloadComposerRunthisinyourterminaltogetthelatestComposerversion:

curl-sShttps://getcomposer.org/installer|php

Orifyoudon'thavecurl:

php-r"readfile('https://getcomposer.org/installer');"|php

Thisinstallerscriptwillsimplychecksomephp.inisettings,warnyouiftheyaresetincorrectly,andthendownloadthelatestcomposer.pharinthecurrentdirectory

YoucanrunthisterminalcommandtomakeComposereasilyaccessible,fromanywhereonyoursystem:

$mvcomposer.phar/usr/local/bin/composer

DownloadDrupal8TheDrupalConsoleprojectonlysupportsDrupal8;whichyouwillneedtodownloadandinstalllocally.

DownloadDrupal

$drupalsite:newdrupal8.dev8.0.0

$cddrupal8.dev

InstallDrupalusingMySQL:

DrupalConsole

132Projectrequirements

Page 133: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

$drupalsite:installstandard--langcode=en--db-type=mysql--db-host=127.0.0.1

--db-name=drupal--db-user=root--db-pass=root--db-port=3306

--site-name="Drupal8SiteInstall"[email protected]

--account-name=admin--account-mail=admin@example.com--account-pass=admin-n

InstallDrupalusingSQLite:

$drupalsite:installstandard--langcode=en--db-type=sqlite

--db-file=sites/default/files/.ht.sqlite--site-name="Drupal8SiteInstall"

[email protected][email protected]

--account-pass=admin-n

StartthePHP'sbuiltinserver

$drupalserver

NOTE:Makesureyouuseyourownuseranddatabasecredentialswhenrunningsite:installandneveruserrootonproduction.Inthisexamplecode,weacceptallinteractivequestions,i.e.answering“yes”whenpassingthe-yargument.

DrupalConsole

133Projectrequirements

Page 134: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

Gettingtheproject

ForkForkyourowncopyoftheConsolerepositorytoyouraccount

CloneGetacopyofyourrecentlyclonedversionofconsoleinyourmachine.

[email protected]:[your-git-user-here]/DrupalConsole.git

InstalldependenciesNowthatyouhaveclonedtheproject,youneedtodownloaddependenciesviaComposer.

$cd/path/to/DrupalConsole

$composerinstall

DrupalConsole

134Gettingtheproject

Page 135: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

RunningtheprojectAfterusingComposertodownloaddependencies,youcanruntheprojectbyexecuting:

$bin/console

CreateasymboliclinkYoucanrunthiscommandtoeasilyaccesstheDrupalConsolefromanywhereonyoursystem:

$sudoln-s/path/to/DrupalConsole/bin/console/usr/local/bin/console.dev

NOTE:Thenameconsole.devisjustanaliasyoucannameitanythingyoulike.

DrupalConsole

135Runningtheproject

Page 136: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

KeepingyourforkuptodateAftersometimeyourforkedrepositoryandtheoriginalone(calledupstream)willeventuallygetoutofsyncleavingyouwithanold,unsupportedversion.

Tosyncchangesyoumakeinaforkwiththeoriginalrepository,youshould:

Configuringaremotefork:SpecifyandconfigureanewremoteupstreamrepositorythatpointstotheupstreamrepositoryinGit.

gitremoteaddupstreamhttps://github.com/hechoendrupal/DrupalConsole.git

FordetailedinformationpleasevisitGithub'sguideConfiguringaremotefork

SyncingyourforkSyncyourforktokeepitup-to-datewiththeupstreamrepository.

gitfetchupstream

gitmergeupstream/master

FordetailedinformationpleasevisitGithub'sguideSyncingafork

DrupalConsole

136Keepingyourforkuptodate

Page 137: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

CreatinganIssueIfyoufoundanissueormaybeyouliketoproposeanewfeaturetotheproject,youneedtoaccessthefollowinglink:

https://github.com/hechoendrupal/DrupalConsole/issues/new

PleasereviewtheguidelinesforcontributingtoDrupalConsoleat:

https://github.com/hechoendrupal/DrupalConsole/blob/master/CONTRIBUTING.md

CreatingaPullRequestRemembertocreateabranchbeforestartdeveloping!It'snameshouldcontaintheissueidandaslugtotellwhatthethingyou'reworkingonisabout,forexample:1337-lorem-ipsum

Ifyouhaven'tyetcontributedtoaprojectonGitHub,oraren'tstillsurewhattheworkflowlookslike,readthedocumentationaboutpullrequests.YoumayalsowishtodownloadtheGitHubapplication(Mac|Windows,whichsimplifiestheworkflowabitandprovidesaniceGUIforyourcontributions).

DrupalConsole

137Creatingissuesandpullrequests

Page 138: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

ContributetothisdocumentationThisdocumentationisawork-in-progressandyouarewelcometopitchinandhelp.SimplyforktheDrupalConsoleBookonGitHub.Ifyouhaven'tyetcontributedtoaprojectonGitHub,oraren'tstillsurewhattheworkflowlookslike,readthedocumentationaboutpullrequests.YoumayalsowishtodownloadtheGitHubapplication(Mac|Windows,whichsimplifiestheworkflowabitandprovidesaniceGUIforyourcontributions).

DrupalConsole

138Contributetothisdocumentation

Page 139: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

InstallationproblemsWhenyourunDrupalConsolefromyourDrupal8rootdirectory,youcangetdifferenterrormessages,wewilltrytocompilethereportedissuesandhowtohavethemfixed.

Errormessage:

[PDOException]SQLSTATE[HY000][2002]Nosuchfileordirectory

Youwillneedtoedityour'host'inyour'settings.php'file.

Navigatetosites/default/settings.php.Inyoursettings.phpfile,changethehosttoread:

'host'=>'127.0.0.1'

orifyour'settings.php'filealreadyreads:

'host'=>'127.0.0.1'

changeittoread:

'host'=>'localhost'.

Afteryoumakethechange,besuretosavethefileandthenrunDrupalConsoleagain.

Errormessage:

[PDOException]

SQLSTATE[HY000][2002]Can'tconnecttolocalMySQLserverthroughsocket'/tmp/mysql.sock'

Creatingasymlinkpointingto/tmp/mysql.sock:

ln-s/path/to/your/mysql/data/mysql.sock/tmp/mysql.sock

DrupalConsole

139Installationproblems

Page 140: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

CommandsnotlistedThisdocumentisawork-in-progress.Atanytime,itispossiblethattheDrupalConsoleprojectisaheadofthedocumentation.Whileweendeavortokeepthisbookup-to-date,itisalwayspossiblethatsomecommandshavebeencreatedfortheDrupalConsole,butarenotyetdescribedinthisdocument.Forafulllistofsupportedcommands,usethelistcommand,e.g.$drupallist

Ifyouseeacommandthatisnotyetdescribedhere,youarealsowelcometocontributetothisdocumentation,usingthe--helpoutputforthecommandasasimplestartingpoint.

DrupalConsole

140Commandsnotlisted

Page 141: Table of Contents - jenny.bourdiol.org | Mon cv et bloc ...jenny.bourdiol.org/sites/jenny.bourdiol.org/files/bookf/drupal... · Table of Contents Drupal Console Documentation

References

DrupalConsolecoderepositoryhttps://github.com/hechoendrupal/DrupalConsole

Documentationrepositoryhttps://github.com/hechoendrupal/drupal-console-book

ResourcesSymfonyComponentsDrupal8PHPtherightwayKNPUniversityBuildamoduleDrupalizeMeGitComposerBox

DrupalConsole

141References