Drupal with composer – What to do and what not to do

Composer Manager allows custom/contributed modules to depend on PHP libraries managed via Composer.

Composer is a command line tool for installing PHP libraries and their dependencies on a per-project basis. These day, all libraries are registered on Packagist(You can define package dependencies here) and expect to be installed via Composer.

Use https://www.drupal.org/project/composer_manager module to start using composer in your drupal 7 project.

Above module manage is composer.json file in


Caution 1: When you use standard git solution i.e github or bitbucket for drupal they will add sites/default/files in gitignore file. Now your drupal admin will give you notices.
Solution: Make sure you have composer.json in sites/default/files/composer You can generate composer.json form admin/config/system/composer-manager Click rebuild composer.json at the bottom of the page.

Caution 2: While you configure composer_manager.module make sure you put
Composer File Directory value as sites/default/files/composer
Don’t add complete physical path in the field as it’s going to be stored in variable composer_manager_file_dir If absolute path of the project doesn’t matches with your path of project in your machine it won’t let you configure your drupal website from admin account. In order to resolve this clear the variable from database
delete from variable where name='composer_manager_file_dir';
Once deleted make sure you truncate the cache folders too as you won’t be able to access configuration section of your drupal admin.
TRUNCATE TABLE cache_block;
TRUNCATE TABLE cache_bootstrap;
TRUNCATE TABLE cache_field;
TRUNCATE TABLE cache_filter;
TRUNCATE TABLE cache_form;
TRUNCATE TABLE cache_image;
TRUNCATE TABLE cache_menu;
TRUNCATE TABLE cache_page;
TRUNCATE TABLE cache_path;
TRUNCATE TABLE cache_token;
TRUNCATE TABLE cache_update;

There are no comments.

Leave a Reply