Drush - Composer

Rating

Drush ( DRU pal SH ell) is a computer software shell-based application that allows you to control and manipulate Drupal websites. At first sight, drush is a tool for updating site modules, but Drush has a more extensive list of functions.

Composer is a "dependency manager" for PHP. By installing a module with composer, all dependencies are installed.

Drush en Composer are already installed in all web hosting packages from Neostrada and can be used via the terminal window. At other hosting companies you may have to install yourself or may not even use it. So best inform before you sign a contract for a hosting.

Drush en Composer commands must be executed from the directory where your Drupal website is installed.

 

Commonly used drush commands

  • cache clearen: drush cr
  • module install: drush en module name (example: drush en address)
    • by placing -y behind the command you no longer have to answer the questions during the installation: drush en modulenaam -y (voorbeeld: drush en address -y)
  • module uninstall: drush pmu module name -y   (voorbeeld: drush pmu address -y)
  • database update: drush updb  
  • overview of your Drupal-site: drush st
st
  • overview of all projects on the site: drush pml
pml

Commonly used composer commands

  • module install: composer require drupal/modulenaam (vb: composer require drupal/pathauto)
  • update dependencies as specified in composer.json: composer update

Useful commands in terminal

  • give a list of files in the current directory : ls
ls
  • go to directory: cd directory name (example: cd modules ensures that you go to the map modules)
  • move up in the folder structure: cd ..
  • remove file: rm (example: rm composer.json)
  • rename file: mv  (vb: mv old_composer.json composer.json)
  • execute multiple commands in 1 line: && (example: rm composer.json && rm.htaccess deleted the files composer.json en .htaccess)
  • make a new directory: mkdir (example: mkdir images creates a new folder with the name images)
  • delete a empty directory: rmdir (example: rmdir images)
  • delete a directory with content: rm -rf mapnaam (example: rm -rf images)
  • third party downloaden: wget (vb: wget https://github.com/yairEO/photobox/archive/1.9.2.zip  download the zip file 1.9.2.zip )
  • clear screen: clear(clears the terminal window)
  • end session : exit (it is recommended to end the session in a normal way before closing the terminal window)
cd