After spinning up a few Drupal 8 sites in the past couple weeks, I think I've finally got the Composer workflow going. Here are the steps I follow for setting up a new Drupal 8 site with Composer.
For me all this is
Just run this command:
composer create-project drupal-composer/drupal-project:8.x-dev app --stability dev --no-interaction
In this case, app is the name of the directory you would like your project in. So my Drupal project is now in
I also got confused about the 8.x-dev because I thought it meant it was going to download a dev version of Drupal 8. I now understand that this version refers to the version of the
drupal-composer/drupal-project version and not the actual version of Drupal you want.
I usually get a snack.
Inside of your virtual machine (I use vagrant) cd into the app/web directory. This is where your site lives.
Now run this command:
..vendor/drush/drush/drush site-install standard \ --db-url=mysql://username:password@vagrant/db-name \ --account-mail="email@example.com" \ --account-name=username \ --account-pass=password \ --site-mail="firstname.lastname@example.org" \ --site-name="Site Name"
If you want to redirect all url.com/web to just server from url.com, create an .htaccess file in your /app directory with this (Apache only):
<ifmodule Rewrite> RewriteEngine on RewriteRule ^$ web/ [L] RewriteRule (.*) web/$1 [L] </ifmodule>
Install modules like this:
composer require drupal/modulename