Speed Up Your Drupal Installation With Composer

Submitted by D2D on Tue, 05/19/2020 - 10:24

I have done a lot of grumbling about having to learn to use Composer to manage dependencies in Drupal, and in a lot of ways it is still al PITA, but I found a way to take advantage of Composer to get started on a new website.

 

The biggest problem with installing a new website in Drupal is that you have to install a theme and several modules before you can start configuring the site that you want to build.  Installing through the Admin interface took quite a while if you had several modules to install.  and, All of the instructions, blog posts, and videos that I have seen involve typing Composer commands one by one.  I finally figured out that Composer commands could be put into a BASH script and all of the modules that I commonly use can be run at once.

 

I still have a problem in that Composer doesn't run in my shared hosting account, but I got XAMPP and Git BASH running on a local computer.  Ostensibly, Composer should run from a Windows Command prompt, but it seems to work better with BASH.

 

Once XAMPP and Git BASH were running on the local machine, it was a matter of using Notepad++ (not Notepad) to create a script that can be run in BASH.  I just had to be careful that the "master" of the script was not stored in a folder that would be deleted when I was removing a local website that was no longer useful.

 

I prefer to use a similar script to install the Drupal site itself and another to do updates.  It saves a lot of bad words that I would say when I phat phingered a command.

 

I now have what amounts to my own "distribution" without having to update everything before I can use it.  The Composer and scripts take care of installing the latest of everything.

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.