Table of Contents
By no means is this a definitive guide, simply a working document to outline steps in process.
You’ll get the majority of the goods here:
Installing Drupal w/ Composer
Drupal Composer config generator (drupal-init)
We’re going to try Option C on above link
The drupal-init command creates a composer.json file usable for Drupal projects in the current directory.
Here is what it looks like:
Commands go something like this:
composer global require hussainweb/drupal-composer-init # navigate to new folder, create composer.json file composer drupal-init
Working with an existing D8 Project?
Check this: https://www.drupal.org/project/composer_generate
Installation - Let’s go!
From what I see, 2 options for installation
- Via browser
- Command line
We’re going with for the Command line installation with Drush
It is recommended that Drupal 8 sites be built using Composer, with Drush listed as a dependency. http://docs.drush.org/en/master/install/
With Drush, you can:
- Download and install Drupal
- Clear cache
- Update Drupal & contrib modules
- Add users and permissions
- Backup & restore
- Run Drupal w/ web server
Since we’re using ‘hussainweb/drupal-composer-init’, we can proceed to install D8
mysql -u root -p create database d8-something; exit;
Let’s install it
drush site-install standard --db-url=mysql://[db_user]:[db_pass]@[ip-address]/[db_name]
Pay attention here - admin password is given here!
Navigate to your local website and you will see Drupal 8 installed.
Header over to Extend and check to see what modules are enabled.
Since we stated that we also wanted a few modules within our composer.json, you will see that they’re not enabled.
drush en [module-name] drush en pathauto
Should any one of them have dependancies, they you get prompted as well.
View your themes
drush pm:list --type=theme
Download & enable module
Download with composer
composer require drupal/bootstrap
Enable with Drush fails - have to enable via D8 admin
drush en bootstrap # get error [error] Unable to install modules Bootstrap due to missing modules Bootstrap.
Here we have:
- Generated composer.json file using hussainweb/drupal-composer-init
- Set up extensions
- Downloaded Drupal 8 in to working folder with composer
- Connected to database and installed with Drush
- Enabled module with Drush
More to follow!