Use Drupal Console and Composer For Faster Development
![Use Drupal Console and Composer For Faster Development](https://ostraining.com/wp-content/uploads/drupal8/drupal-8-console-composer.jpg)
One of our OSTraining members asked us about the best way to install Composer to manage dependencies.
While Composer can be used to add module dependencies in Drupal, it’s more practical to also use DrupalConsole to handle the process. Console automatically passes the requests to Composer.
From the terminal command line running the following commands will install both Console and Composer together.
# Download Drupal Console which contains cCmposer:
- php -r “readfile(‘https://drupalconsole.com/installer’);” > drupal.phar
# Move the install so you can access it from anywhere on the system:
- mv drupal.phar /usr/local/bin/drupal
# If you can not execute the above command, you do not have admin access, using ” sudo mv drupal.phar /usr/local/bin/drupal ” should work on unix based systems.
# Apply executable permissions on the downloaded file:
- chmod +x /usr/local/bin/drupal
# Copy configuration files to user home directory:
- drupal init –override
# Check and validate system requirements. This will provide suggestions for best use:
- drupal check
# Move into the folder you want to install Drupal into, or the existing Drupal folder:
- cd /var/http/drupal
# Download, install and serve Drupal 8:
- drupal chain –file=~/.console/chain/quick-start.yml
# Create a new Drupal 8 project:
- drupal site:new drupal8.dev
# Lists all available commands:
- drupal list (console)
- composer (composer)
# Check you have the latest versions :
- drupal self-update
- composer self-update
Now that we have both composer and console installed, you will need to familiarise yourself with the commands
When i run php -r “readfile(‘https://drupalconsole.com/installer’);” > drupal.phar in terminal command line it is showing ‘php’ is not recognized as an internal or external command,
operable program or batch file.