Drupal8 starter with composer and Docker
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 13 commits ahead of louisbl:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Drupal 8 starter project with Docker and composer

It's based on the Composer template.


First you need to install composer.

Note: The instructions below refer to the global composer installation. You might need to replace composer with php composer.phar (or similar) for your setup.

After that you can create the project:

git clone git@github.com:OzConseil/drupal-project.git my-new-drupal

Install all dependencies with composer create-project

cd my-new-drupal
composer create-project --stability dev --no-interaction

Use drush si to install Drupal. If you launch drush without the composer script you must specify the root directory: ./vendor/bin/drush --root=html site-install.

// with local sqlite db
composer drush -- site-install --db-url=sqlite://site/default/files/.ht.db.sqlite
// with MySQL db
composer drush -- site-install --db-url=mysql://user:pass@server:port/dbname

With composer require ... you can download new dependencies to your installation.

cd some-dir
composer require drupal/media_entity:8.1.*

What does the template do?

When installing the given composer.json some tasks are taken care of:

  • Drupal will be installed in the html-directory.
  • Autoloader is implemented to use the generated composer autoloader in vendor/autoload.php, instead of the one provided by Drupal (web/vendor/autoload.php).
  • Modules (packages of type drupal-module) will be placed in html/modules/contrib/
  • Theme (packages of type drupal-module) will be placed in html/themes/contrib/
  • Profiles (packages of type drupal-profile) will be placed in html/profiles/contrib/
  • Latest version of drush is installed locally for use at vendor/bin/drush.

Generate composer.json from existing project

With using the "Composer Generate" drush extension you can now generate a basic composer.json file from an existing project. Note that the generated composer.json might differ from this project's file.


Should I commit the contrib modules I download

Composer recommends no. They provide argumentation against but also workrounds if a project decides to do it anyway.