Composer | Modules Unraveled

151 Using Composer to Build Drupal Sites Fast - Modules Unraveled Podcast

Photo of Tim Millwood

Composer

  • What is composer?
    • Dependency Manager for PHP
  • How does it relate to Drush Make?
    • Surprisingly similar
    • “Getting off the island”
  • What can you do with composer on a Drupal site?
    • download dependencies, drupal modules, themes, profiles, drush, external libraries etc
  • How do you download contrib modules?
    • https://packagist.drupal-composer.org/
  • How do you download contrib themes?
    • ^^
  • Can you specify where to download project? ie: modules/contrib and modules/custom?
    • composer/installers & davidbarratt/custom-installer
  • Where do you store custom modules/themes?
    • Two methods: Committing to your repo or creating separate repos
    • Reference repo in you composer.json
    • Toran Proxy
    • davidbarratt/custom-installer
  • How can you specify and download a library to go with a module?
    • module should specify it in composer.json
    • if not submit a patch, and add to your composer.json for now
  • Patches
    • cweagans/composer-patches

Use Cases

  • drupal/drupal vs drupal/core
    • http://cgit.drupalcode.org/drupal/tree/composer.json
    • If you want to use the project-repo/web
    • composer create-project drupal/drupal
  • Composer template for Drupal Projects
    • https://github.com/drupal-composer/drupal-project
  • Build sites from scratch with composer install
  • Update drupal/modules/themes/etc. with composer update