Install A Drupal 8 Module With Composer

Submitted by Mile23 on Sat, 11/08/2014 - 12:06

Just a heads-up of a proof-of-concept I did.

Here's a github repo for the page_example module from examples. I've added a composer.json file which requires symfony/console (arbitrarily), and composer/installer (to make it work): https://github.com/paul-m/composer-drupal-module

I then made a packagist.org entry for it: https://packagist.org/packages/mile23/page-example

Go to the root of your Drupal 8 installation in the terminal. Type this:

$ composer require mile23/page-example dev-master

Composer will do what it's supposed to do and put the module in modules/, and add console to vendor/.

This means you can use Composer to manage dependencies. Since that's what it's for. :-)