The Composer Manager module is a useful module for those interested in taking advantage of Composer and PSR-connected design patterns in Drupal 7. Using such methods generally result in stable, better-vetted solutions using modern PHP development practices.
The module is a dependency of several contributed modules on Drupal.org, including the Amazon S3 module, a module that Acquia recommends when clients express a need for either large numbers of files, or large file storage: https://docs.acquia.com/cloud/files/terabytes
Configuring Composer Manager for Acquia Hosting
Configuring this module for Acquia Hosting is simple, as long as you follow a simple pattern:
- Adding
$conf
variables tosettings.php
that tell Composer Module where to begin its identification patterns, so it can find it's dependencies - Always conduct your builds locally - this is considered an essential best practice. Composer Manager requires write access to directories - in particular, the
composer.json
file - and due to the secure nature of our hosting environment, we do not allow write access to files outside /tmp or the files directory (in most cases, the distributed file system). This is mitigated by testing and committing your code locally (preferred) or in LiveDev mode on a non-Production environment. Composer Manager will not attempt to rebuildcomposer.json
or vendor packages otherwise - Be aware of a critical bug fix: the bug was addressed in the latest Dev release of the module (as of 16 Sept 2016): https://www.drupal.org/project/composer_manager/releases/7.x-1.x-dev
General changes to settings.php:
In general, you should be able to copy and paste this code directly into your site's settings.php
file, beneath the Acquia require line:
$conf['composer_manager_vendor_dir'] = '../vendor';
$conf['composer_manager_file_dir'] = '../';
if (isset($_ENV['AH_SITE_GROUP']) && isset($_SERVER['SCRIPT_FILENAME']) && strpos($_SERVER['SCRIPT_FILENAME'], 'livedev') === FALSE) {
$conf['composer_manager_autobuild_file'] = 0;
$conf['composer_manager_autobuild_packages'] = 0;
}
These changes will:
- set the vendor directory to
../vendor/
- set the
composer.json
path to../composer.json
More Information